jQWidgets Forums

jQuery UI Widgets Forums Grid Changing AJAX request, new data fails to bind

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

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

  • mcfloyd
    Participant

    Hello, I have been investigating an issue for a while now. I have two public methods to my grids, the first is to initialize the grid and fill with data from the first request, and the second is to update the grid while changing the AJAX request sent to the server. I am seeing the grid render with the rendered callback function as if the data was bound back to the grid, but the data does not change for some reason. Also, when changing the page size, the data is blank for rows that weren’t set up in the original request.

    When I look at the dataAdapter object with console.log() after changing the grid source in my update function, it contains the data from the initialization function, but not the new data. Also, I can see the new data in the AJAX call that the grid is running.

    Here is my public update function:

            updateSearchDetails: function(searchType, searchString, columnName)
            {
                var ajaxRequestData = {
                    data: 'data',
                    search_type: searchType,
                    search_string: searchString,
                    column_name: columnName
                };
                searchDetailsSource.data = ajaxRequestData;
                var dataAdapter = new $.jqx.dataAdapter(searchDetailsSource);
                $("#jqxSearchDetailsGrid").jqxGrid({source: dataAdapter});
            },

    mcfloyd
    Participant

    Figured this out. Needed to add to the rendergridrows callback function of the jqxGrid() initialization:

    rendergridrows: function(data){
        dataAdapter.records = data.data;
        return dataAdapter.records;
    },

    I had my root set to “data”, which is why the initialization worked properly. Why didn’t it work on the update?


    Hristo
    Participant

    Hello mcfloyd,

    To change the data in Grid – first set source.url, next step – dataAdapter.dataBind();, and on last $("#grid").jqxGrid('updatebounddata');.
    This theme could be helpful too.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.