i have a problem with find my new row in datatabel after add and sort.
I have a datatable with few rows. i add a new/ item(s) and after that i want to show/focus this item.
$$("mainTable").parse(data.json().items);
$$("mainTable").sort(gl_orderby, gl_orderdir);
updRow = $$("mainTable").find(row => row.azbucid == firstBucId, true);
$$("mainTable").showItem(updRow.id);
but updRow is NULL. It works, if i don’t make “refresh” - but in this case the datatable is not correcty sorted.
Hi @ObiWanKenobi
Is there any chance that gl_orderby
is a custom function where you modify the values in incoming objects?
The sorting functors receive data objects directly, so if you change the value of azbucid
field, these changes will appear in the table. Here’s an example (uncomment the line 18 to see the error): Code Snippet
hi,
gl_orderby is not a function, it is a variable. I make no changes.
Thank you for clarifying this.
However, without further details an unexpected change of data field was the best explanation. I have also double-checked our built-in sorting methods and none of them seems to affect the data nor cause find
to provide different result after sorting.
Could you please provide an example (a snippet, if possible) so we can test the issue with a similar configuration?
Hi,
I have tried to create a snippet, but with small snippet it works fine. so i have tried to make my programm a little bit smaller and i found the problem - i have defined $$(“mainTable”).attachEvent("onAfterSort", … and that was the problem. My mistake - i’m sorry!
Thank you for your help.