TurboTable : The array of objects displayed in the table does not respect its original order
I'm submitting a ... (check one with "x")
[ x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Current behavior The array of objects order's changed. The data sent to the table component (input [value]) are note rendered in the same exact order. The data displayed has values that do not respect their original order. Note : I do not encounter this problem on Firefox.
It's difficult to build a Plunker that could be working only on Chrome and not on Firefox. So I will try to explain explicitly what I saw with an example.
Exemple : The array of objects ordered by code ASC, color ASC, version DESC, ...
[
{ code: "AAA", color: "blue", version: 2 },
{ code: "AAA", color: "blue", version: 1 },
{ code: "BBB", color: "red", version: 3 },
{ code: "BBB", color: "black", version: 2 },
{ code: "BBB", color: "black", version: 1 },
{ code: "CCC", color: "yellow", version: 1 },
{ code: "CZZ", color: "blue", version: 1 },
{ code: "EEE", color: "blue", version: 2 },
{ code: "EEE", color: "black", version: 1 },
...
]
... might be rendered as below.
[
{ code: "CCC", color: "yellow", version: 1 },
{ code: "AAA", color: "blue", version: 2 },
{ code: "AAA", color: "blue", version: 1 },
{ code: "BBB", color: "red", version: 3 },
{ code: "BBB", color: "black", version: 2 },
{ code: "BBB", color: "black", version: 1 },
{ code: "CZZ", color: "blue", version: 1 },
{ code: "EEE", color: "blue", version: 2 },
{ code: "EEE", color: "black", version: 1 },
...
]
For whatever reason, some values inside the array changed their place.
The object { code: "CCC", color: "yellow", version: 1 } went from index 5 to index 0.
Expected behavior I want the array of objects to be rendered in the same order.
Minimal reproduction of the problem with instructions I do not encounter the problem with :
- a dataset of 5 values and 8 columns
I encounter the problem with :
- a dataset of 11 values and 8 columns
- a dataset of 105 values and 2 columns
What is the motivation / use case for changing the behavior? It becomes a problem if Chrome is the target browser.
-
Angular version: 5.2.1
-
PrimeNG version: 5.2.0-RC2
-
Browser: Chrome 62.0.3202.94 & Firefox ESR 45.2.0
-
Language: TypeScript 2.6
-
Node (for AoT issues):
node --version= v8.9.4
Sounds like related to;
https://stackoverflow.com/questions/37190016/orderby-is-sorting-differently-in-chrome-than-other-browsers
You may try sortFunction to take over browser sorting.
Hi @cagataycivici !
I already used a sort function to sort my data. Using p-dataTable my data are ordered as expected. But using p-table it's not the case.
Maybe I misunderstand what sortFunction you're referring to ?
@cagataycivici I think this may need to be reopened. This issue still exist in primeng version 5.2.0 here i am not using sortFiled just I want the array of objects to be rendered in the same order in hmtl.
Workaround to this issue posted to #5050