Datatable state update on data loading

I have added a save state procedure for the datatable onAfterColumnDrop and onColumnResize. If I know load 20er blocks on a 40-50 entries datatable, then I see onColumnResize firing up several times, way more often then the amount of data requests. I mean like I have 3 loadings of data in the console and 1 onColumnResize for every single entry, so 40-50 times. It is also so that not every entry actually changes the sizes of the column, the entries are pretty balanced, so it makes no sense obviously.

Is there any obvious way to optimize that?



  • edited June 27


    Could you please provide a demo of your issue?

    The onColumnResize event fires each time when:

    • you set datatable state;
    • you actially resize a column (by dragging or via setColumnWidth);
    • when Datatable structure is updated, i.e. when columns are formed or refreshed.

    The latter one can cause the above problems, but the demo is really welcome to see the whole workflow.

  • The last one is actually the problem. Now I can't make an "automatic save" without hammering Ajax requests to the master, and have to fall back to a "Save State" button. I could now add up a function that compares the state and only goes to server on an actual change, but the question is if that shouldn't anyway be an event? That would be clearing up this problem.

  • When you actually resize a column by mouse drag, the 4th parameter - user_action will be set to true. It was added exactly for your use-case, to detect resize calls which may need to be saved on a server-side.

  • aaaahhhh great, thanks

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!