jQWidgets Forums

jQuery UI Widgets Forums Grid JQX Grid rebinds when "pageable" property is set.

This topic contains 3 replies, has 2 voices, and was last updated by  Martin 6 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • Indumathi
    Participant

    Hi,

    We are using JQX grid to display data and the data to the grid is bound dynamically (loadServerData), and based on no of rows returned, we should hide/show pagination strip at the bottom of the grid.
    So I have added the below code to my “bindingcomplete” event:-
    $(‘#AMS_jqxgrid’).on(‘bindingcomplete’, function (event) {
    // apply localization.
    $(“#AMS_jqxgrid”).jqxGrid(“localizestrings”, localizationobj);
    if (source.totalrecords <= 200) {
    $(“#AMS_jqxgrid”).jqxGrid({ pageable: false });
    }
    else {
    $(“#AMS_jqxgrid”).jqxGrid({ pageable: true });
    EnableDisablePreviousNextButtonsOfJQXGrid();
    }
    });
    Hiding/Showing of the Pagination strip works great but, ajax call to get/bind data is made twice instead of once. First when we are initially loading the page and second time when we are setting the pageable property in “bindingcomplete” event.

    Can we avoid the second call, but still have my logic for hiding and showing the Pagination strip?

    Thanks,
    Indu.


    Martin
    Participant

    Hello Indu,

    Unfortunately, you cannot prevent the grid from rebinding because setting the pageable property changes the grid’s state.
    I would suggest you to use a flag which checks if this is the first call or not.

    If you are still having a difficulty, you can send us a larger example with your grid initialization and ajax call, so we can take a look.

    Best Regards,
    Martin

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


    Indumathi
    Participant

    Thank you so much for your reply!!
    Can you give me an example of your approach (using a flag to check if it is first call or not)?

    Thanks,
    Indu.


    Martin
    Participant

    Hello Indu,

    This was just a suggestion.
    Can you, please, provide an example of your use where this double ajax call issue is reproduced,
    so I can take a look?
    Thank you!

    Best Regards,
    Martin

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

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

You must be logged in to reply to this topic.