Menu
Download Free Trial

Sort time fields doesn't work

Hi!
I’m trying to sort fields with type “datetime” in rows, but the feature doesn’t seems to work with this type.
The format in the JSON datasource uses the format “YYYY-MM-DD hh:mm:ss” and currently the format is set to “datetime”. I Made a test using a field with “time” fotmat and the sort didn’t work too. I also tried to put a ‘t’ between the date and time (“YYYY-MM-DDthh:mm:ss”) but the pivot can’t convert this way (it put every date back to 1969-01-01).
When I try to use the window for sort and filter values (by click at the header of the field) and try to sort there and by using the method “setSort”, in both methods we can see the rows changing the order, but not properly sorting it only change the position randomly. Same test with both types “time” and “datetime”.
Type “date string” works fine. In the measures header sort icon for type “time” works great too.
Yet another strange behavior: We have a field in JSON to aggregate the data each five minutes, this field receive the type “datetime”. When I try to sort this field (I put it in rows field) it kind of sort aparently but when you take a look row by row it mixing the days. Ex: it starts at day 25 (sort the time properly), then goes to day 22 and 21, and then things start to crack, it goes to day 26, 25, 22, 21, 26 again but this time without sorting the time anymore.
The Flexmonster PivotTable version is “Version 2.403 (build 11/09/2017 09:44:07) – Edition: CSV/JSON/SQL Unlimited – Pivot Table & Charts Component – Developer’s version“. I tried loading the default language and the “Portuguese” translation JSON. I tried the 2.4 version too.
Regards,
Elizeu

4 answers

Public
Tanya Gryshko Flexmonster October 6, 2017

Hello, Elizeu,
Thank you for providing the detailed report of the issue. For your case, we recommend replacing "datetime" with "date string" everywhere. "datetime" should be used for other purposes.
Please keep in mind that datePattern is used to set the pattern for "date string". Here is the sample: http://jsfiddle.net/flexmonster/tc8yosgd/.
Let me know if your issues were resolved.
Regards,
Tanya

Public
Madeira October 9, 2017

Hi,
with “date string” the hour doesn’t show, the behavior is not the same as the example provided.
Regards, Elizeu

Public
Dmytro Zvazhii Flexmonster October 10, 2017

Hello Madeira,
Thank you for writing. The example provided by my colleague Tanya is based on the latest Flexmonster Pivot Component version. For now, the latest version is 2.405. Please make sure that you are using the latest version of the component. Also, do not forget to apply the datePattern . It will look like the following:
options: {
      datePattern: "yyyy-MM-dd HH:mm:ss"
}

Please let us know if everything works fine for you.
Regards,
Dmytro.

Public
Madeira October 11, 2017

Hi,
We will use the final version them.
The last answer solved my problem.
Thank once again.
Regards, Elizeu

Please login or Register to Submit Answer