jQWidgets Forums

jQuery UI Widgets Forums Grid cannot refresh data in grid

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • cannot refresh data in grid #55437

    arkgroup
    Participant

    I have grid working with data coming from AJAX call. Then I tried to refresh data in grid on button click, but have to results. I tried to create new dataAdapter, but loadComplete not firing. Tried different option (comment out), but have no luck.
    I tested and I have data returned from AJAX call. Please help.
    Here is code snippet:
    $(“#print”).click(function () {
    var _month = “12”;

    var _year = “2013”;

    var jsonStr = “{‘year’ : ‘” + _year + “‘,” +
    “‘month’ : ‘” + _month +
    “‘}”;

    var data1 = {};
    $.ajax({
    type: ‘POST’,
    datatype: ‘json’,
    async: false,
    url: ‘Default.aspx/GetData’,
    data: jsonStr,
    cache: false,
    contentType: ‘application/json; character=utf-8’,
    success: function (data) {

    data1 = $.parseJSON(data.d);

    },
    error: function (err) {
    alert(err);
    }
    });

    source.localdate = data1;

    $(“#jqxgrid”).jqxGrid({ source: data1 });

    $(“#jqxgrid”).jqxGrid(‘updatebounddata’);

    //var dataAdapter = new $.jqx.dataAdapter(source);

    // var dataAdapter = new $.jqx.dataAdapter(source, {
    // downloadComplete: function (data, status, xhr) { alert(data); },
    // loadComplete: function (data) {
    // alert(data);
    // $(“#jqxgrid”).jqxGrid(‘updatebounddata’);

    // },
    // loadError: function (xhr, status, error) { alert(error); }
    // });

    // dataAdapter.dataBind();
    // $(‘#jqxgrid’).jqxGrid({ source: data1 });
    // dataAdapter.dataBind();
    // $(‘#jqxgrid’).jqxGrid(‘refreshdata’);
    // $(‘#jqxgrid’).jqxGrid(‘refresh’);
    // $(“#jqxgrid”).jqxGrid(‘endupdate’);

    });

    cannot refresh data in grid #55460

    Peter Stoev
    Keymaster

    Hi arkgroup,

    If you want to replace the Grid’s source you have to set its source property to new DataAdapter. If you want to update the data using the same dataAdapter you should call the Grid’s “updatebounddata” method. That’s it.

    Best Regards,
    Peter Stoev

    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.