jQWidgets Forums

jQuery UI Widgets Forums Grid Dynamic column generation giving error

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 8 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Dynamic column generation giving error #91667

    puneetdhingreja
    Participant

    Hi, My Grid code is as below. I am trying to bind the columns from the data returned, and the function addAllColumnHeaders returns the column information. But when I try to bind the columns of Grid it gives the error “The data is still loading. When the data binding is completed, the Grid raises the ‘bindingcomplete’ event. Call this function in the ‘bindingcomplete'”. Can you specify the exact method where should I be doing this?

    var source =
                    {
                        datatype: "json",
                        filter: function () {
                            $targetDiv.jqxGrid('updatebounddata', 'filter');
                        },
                        sort: function () {
                            $targetDiv.jqxGrid('updatebounddata', 'sort');
                        },
                        root: 'Rows',
                        columns: [],
                        datafields: [],
                        beforeprocessing: function (data) {
                            var columns1 = [];
                            var datafields = [];
                            source.totalrecords = data.TotalRows;
                            var d = addAllColumnHeaders(data);
                            source.columns = d[0];                        
                            source.datafields = d[1];
                            var viewData = [];
                            var totalRecords = data.Rows.length;                      
    
                            return viewData;
                        },
                        url: url + scriptId + "/" + viewIndex + "/" + viewid
                    };
    
    var dataAdapter = new $.jqx.dataAdapter(source, {
                        formatData: function (data) {
                            source.url = source.url + "/" + loadFromState;
                            return data;
                        },
                        beforeLoadComplete: function (data) {
                            //$targetDiv.jqxGrid('columns', source.columns);
                        },
                        loadComplete: function () {
                            source.url = url + scriptId + "/" + viewIndex + "/" + viewid + "/false";
                            loadFromState = false;
                            $targetDiv.jqxGrid('columns', source.columns);
                        }
                    });
    
    $targetDiv.jqxGrid(
                    {
                        width: '100%',
                        height: jqxGridHeight,
                        source: dataAdapter,
                        altrows: true,
                        rowsheight: 23,
                        pageable: true,
                        autoloadstate: false,
                        autosavestate: false,
                        pagesize: 100,
                        //pagermode: 'simple',
                        virtualmode: true,
                        rendergridrows: function (obj) {
                            return obj.data;
                        },
                        ready: function () {
                            loadState(savedState, source.columns, $targetDiv, source);
                        },
                        autoshowfiltericon: true,
                        columnsresize: true,
                        columnsreorder: true,
                        groupable: true,
                        sortable: true,
                        filterable: true,
                        //columns: source.columns,
                        selectionmode: 'singlecell',
                        editable: false,
                        
                    });
    Dynamic column generation giving error #91709

    Hristo
    Participant

    Hello puneetdhingreja,

    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.
    The bindingcomplete event allows you to register when the first operation has been completed so that you can start another.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.