jQWidgets Forums

jQuery UI Widgets Forums Grid sorting problem with virtual grid

This topic contains 9 replies, has 3 voices, and was last updated by  Hristo 4 years, 12 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • sorting problem with virtual grid #102180

    roman123
    Participant

    Hi,

    I have a problem with sorting in a grid using virtualmode in combination with a dataadapter using the loadServerData callback, here is a simplified example:

    https://jsfiddle.net/roman2/5czpvx4w/40/

    when scrolling through the grid, the sort function is constantly called. I could work around that to prevent unnecessary update calls, but even that doesn’t prevent that sometimes the grid trips over itself:

    Uncaught Error: jqxGrid: The data is still loading. When the data binding is completed, the Grid raises the ‘bindingcomplete’ event. Call this function in the ‘bindingcomplete’ event handler.

    The core problem seems to be that the grid tries to keep updating the sorting, even though that’s already handled on the server side. How can I prevent this?

    Thanks,
    Roman

    sorting problem with virtual grid #102209

    Hristo
    Participant

    Hello Roman,

    Could you clarify your issue?
    I am not sure I understand you very well your case.
    This error can be thrown when server-side processing is enabled and you are trying to initiate one operation (sorting/filtering) before another (sorting/filtering) has been completed.
    You could try to bind to “bindingcomplete” event with it you will understand when one operation is finished.

    Please, take a look at this demo, too:
    https://www.jqwidgets.com/jquery-widgets-demo/demos/php/serversorting.htm?light

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    sorting problem with virtual grid #102214

    roman123
    Participant

    Hi,

    The problem is the sort is not initiated by my code, this is the call trace for the source.sort() function:

    sort @ (index):37
    sortby @ jqx-all.js:109
    dataview.update @ jqx-all.js:93
    q @ jqx-all.js:93
    l @ jqx-all.js:93
    callDownloadComplete @ jqx-all.js:19
    K @ jqx-all.js:19
    (anonymous) @ (index):54
    setTimeout (async)

    I’m simply calling the callback here I got from loadServerData(). The error case is identical, except that it doesn’t make it into my source.sort() function.
    My question is: why is that callback attempting to sort anything? It just got the sorted data back from the server.

    Roman

    sorting problem with virtual grid #102233

    Hristo
    Participant

    Hello Roman,

    It is not necessary to use the “loadServerData” callback.
    If you bind the data in the right way and using server sorting it should happen on the server side as in this example.

    The loadServerData callback function which allows you to manually handle the ajax calls through the jqxDataAdapter.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    sorting problem with virtual grid #102235

    roman123
    Participant

    Hi,

    I’m updating the grid via a websocket, so using loadServerData is the only option I know of.
    Another key aspect is the use of virtual mode, so with huge tables only the visible part is loaded as needed. Your example loads all the data at once, so it’s not applicable to my problem.
    When scrolling through a virtual and sorted grid and when it tries to load additional data, only then the problem is triggered. For some reason the grid tries again to sort the received data and sometimes produces that exception.

    Roman

    sorting problem with virtual grid #102259

    Hristo
    Participant

    Hello Roman,

    There is another callback that is possible to use downloadComplete
    With virtual mode the data is loaded on demand.
    Please, take a look at these demos:
    – PHP: “Grid Server Paging”
    – Java: “Grid Server Sorting, Paging and Filtering”

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    sorting problem with virtual grid #102265

    roman123
    Participant

    Hi,

    Why can’t I use loadServerData? It’s a documented API, which in this situation doesn’t seem to work properly.
    Can you please look at the example I posted initially?
    You only need to open the console, scroll through the list and you’ll see at least the sort prints, which shouldn’t happen and sometimes it throws an exception.
    Unless I’m doing something wrong, this looks to be a bug in jqxGrid.

    Roman

    sorting problem with virtual grid #102335

    Hristo
    Participant

    Hello Roman,

    I would like to suggest you look at this forum topic.
    There you could find out the specifics of the implementation of the loadServerData callback.
    It is created for the real server case.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    sorting problem with virtual grid #111729

    olegr
    Participant

    Hi,

    Still the same exception in 2020 🙁
    at c.<computed>.sortby (jqx-all.js:99)
    at b.jqx.dataview.dataview.update (jqx-all.js:83)

    sorting problem with virtual grid #111738

    Hristo
    Participant

    Hello olegr,

    Could you clarify your issue?
    Please, provide a source code that demonstrates this.
    Meanwhile, I would like to suggest you try to use all the needed *.js” files instead of the jqx-all.js” file.
    This will be one fast test to recognize what causes the issue.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.