Grid.data.update

Hello;

https://snippet.dhtmlx.com/ttlf3lbr

in that snippet i add 1000 records then i search country header filter. After searching header filter “aa1” i put code to change no to show number list automatically.

but if the records 8000 then it will stuck.

am i doing wrong? or 8k records is too much for the grid to that opration?

Please, try to use the silent updating mode:

    grid.data.forEach(function (item, index, array) {
            grid.data.update(item.id, { no: i++},true); //third parameter is "true"
            grid.paint() //repaint the grid
        });

In this case the grid won’t repaint automatically after each update() operation and you should call paint() manually after all the changes finish.
Here is the updated example:
https://snippet.dhtmlx.com/sm62plzr

1 Like

DHTMLX Snippet Tool this snippet 9.1.3 or your example DHTMLX Snippet Tool

pls type county aa9998 then click No 2 times and its sort by no desc.

then remove the characters one by one in Country aa999 aa99 aa99 then you will see it is take time to filter.

i add this code to handle.

grid.events.on("beforeSort", (column, dir) => {
grid.data.sort({ by: column.id, dir: dir }, { smartSorting: false });
     return false;
});

is it correct way to do?

thanks

Hi,

The best workaround to implement row numbering in your case is to use the template: () => {} property for the numbered column (see template documentation).

There are two possible approaches:

  1. Using the .getIndex() DataCollection method - getIndex method documentation
    Example: DHTMLX Snippet Tool
  2. Using the row.$index service property
    Example: DHTMLX Snippet Tool
    Please note that $index is a service property and may change in future versions without notice.

However, it’s important to note that there is currently no official built-in support for row numbering. As a result, in this workaround, row numbers will always start from 1, even when sorting in descending order — the first visible row will still be numbered as 1.

I’ve passed your suggestion to our development team, and it may be considered for one of the upcoming updates. Thank you for your feedback!