jQWidgets Forums

jQuery UI Widgets Forums Grid updatebounddata and grouping

This topic contains 5 replies, has 2 voices, and was last updated by  Benny 4 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • updatebounddata and grouping #135535

    Benny
    Participant

    Hi,

    I’ve been working on switching “view” on an active grid. After much testing I’ve found out that updatebounddata sometimes removes grouping:
    $(‘#jqxgrid’).jqxGrid(‘groups’, [‘firstname’]);
    $(‘#jqxgrid’).jqxGrid(‘updatebounddata’); // No extra parameter: sorting is removed.

    When supplying an extra parameter, the grouping is not removed:
    $(‘#jqxgrid’).jqxGrid(‘groups’, [‘firstname’]);
    $(‘#jqxgrid’).jqxGrid(‘updatebounddata’, ‘filter’); // works with ‘sort’, ‘data’ and ‘cells’ as well.

    Should grouping always be done after updatebounddata, or is there something I’m missing?

    updatebounddata and grouping #135538

    Benny
    Participant

    Correction last post is about grouping: // No extra parameter: grouping is removed.

    After some more testing, It seems that the same does apply for sorting:
    $(‘#jqxgrid’).jqxGrid(‘sortby’, ‘firstname’, ‘desc’);
    $(‘#jqxgrid’).jqxGrid(‘updatebounddata’); // sorting is removed

    $(‘#jqxgrid’).jqxGrid(‘sortby’, ‘firstname’, ‘desc’);
    $(‘#jqxgrid’).jqxGrid(‘updatebounddata’, ‘sort’); //sorting remains, but only when passing ‘sort’ or ‘cells’

    updatebounddata and grouping #135540

    admin
    Keymaster

    Hi Benny,

    This is the idea of these parameters of updatebounddata, to keep the sorting, filtering, etc. Otherwise, updatebounddata re-bind and re-renders completely the Grid component.

    Regards,
    Peter

    jQWidgets Team
    https://www.jqwidgets.com/

    updatebounddata and grouping #135541

    Benny
    Participant

    I expected updatebounddata() to keep the configured sorting and grouping and completely re-bind and re-render everything, since in the documentation is says: “To make a full update, do not pass any parameter.”

    However after doing some performance testing, the grid API seems to be more designed to respond to user inputs, applying one change at a time. When making many changes in one go, it is very inefficient and I need to deal with all these strange cases. It is much faster to create a new grid, which also simplifies my code a lot. Creating a new grid is very fast.

    updatebounddata and grouping #135542

    admin
    Keymaster

    Hi Benny,

    For multiple updates at once, the Grid also has beginupdate and endupdate methods. The first one stops the rendering, the second one resumes it.

    Regards,
    Peter

    jQWidgets Team
    https://www.jqwidgets.com/

    updatebounddata and grouping #135543

    Benny
    Participant

    beginupdate does not work for me. When calling setoptions or groups, I get the error: Cannot read properties of null (reading ‘visiblerecords’).

    $(‘#jqxgrid’).jqxGrid(‘beginupdate’);
    $(‘#jqxgrid’).jqxGrid(‘groups’, [‘firstname’])
    $(‘#jqxgrid’).jqxGrid(‘endupdate’);

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.