jQuery UI Widgets Forums Plugins Data Adapter Async remote call gives error

This topic contains 5 replies, has 2 voices, and was last updated by  Pietervk 8 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Async remote call gives error #89372

    Pietervk
    Participant

    When using async:true on the source I get this 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.

    This has been reported by others, but I have not seen a solution for it.

    I have created a jsfiddle here: http://jsfiddle.net/petitbarzun/o1390z0r/ (once I have a solution, I will remove the data it binds too).

    It works when you set async:false, but gives the mentioned errors in the console with async:true. It also works the first time it is called when you run the fiddle. The error is produced when you click one of the buttons to get new data.

    Async remote call gives error #89420

    Pietervk
    Participant

    Some further testing: .on(“bindingcomplete”, function (event) is not firing the first time after a page refresh (the grid is filled). It is firing after that, and that is when the above mentioned error occurs.

    Async remote call gives error #89429

    Peter Stoev
    Keymaster

    Hi Pietervk,

    binding complete is raised whenever the data source is updated. It does not matter whether it is async or is not. If you bind to the event correctly and the binding is completed after you bind to the event, the event will be raised. This works without any issue.Example: http://jsfiddle.net/jqwidgets/74CTB/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Async remote call gives error #89443

    Pietervk
    Participant

    Thanks Peter,
    My issue was not with bindingcomplete, I thought it was related to the problem, but maybe not.
    My issue is with this 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.

    Can you check with my jsfiddle? You can see the error in the console. In the example, it still goes through. In my actual code it breaks the page, as it stops processing my script.

    Thanks

    Pieter

    Async remote call gives error #89450

    Peter Stoev
    Keymaster

    Hi Pieter,

    The problem is that setting all these properties again will re-bind the Grid multiple times. Setting the source property auto-binds the Grid and then you call dataBind again which raises an exception meaning that data-binding is in process. It is also not necessary to set again the columns and the other properties.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Async remote call gives error #89543

    Pietervk
    Participant

    Thanks Peter,
    you put me on the right track, it is now working. I have removed the jsFiddle. I wanted to continously update a grid, so that works now with this:

    var refreshTim;
        function refreshGrid()
        {
            clearTimeout(refreshTim);
    
            if ($('#jqxgrid').is(":visible"))
            {
                 $('#jqxgrid').source = dataAdapter;
                $('#jqxgrid').jqxGrid("updatebounddata", "cells");
            } else
                return;
            refreshTim = setTimeout(refreshGrid, 30000);
        }
    
        $("#jqxgrid").on("bindingcomplete", function (event)
        {
            clearTimeout(refreshTim);
            refreshTim = setTimeout(refreshGrid, 30000);
        });
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.