jQWidgets Forums

jQuery UI Widgets Forums Grid Refresh grid after ajax save

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 11 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Refresh grid after ajax save #50519

    ssp
    Participant

    Hi,

    How will I refresh the grid on saving through ajax call:

    `var dailyData =DayColGridDataField;
    var dailysrc =
    {
    datatype: “json”,
    datafields:daydataFieldColumns,

    localdata: dailyData,
    url: ‘jqxgridDaily.htm’,
    };
    $(“#jqxgridDaily”).jqxGrid(
    {
    width: 1015,
    pagesizeoptions: [’10’, ’15’, ’20’],
    pagesize: 15,
    source: dataAdapter,
    autoheight: true,
    sortable: false,
    pageable: true,
    altrows: true,
    editable: true,
    enabletooltips: true,
    theme: ‘energyblue’,
    showstatusbar: true,
    statusbarheight: 25,
    showaggregates: true,
    columnsheight: 50,
    columnsresize: true,
    selectionmode: ‘multiplecellsadvanced’,
    columns:daygridColumns
    });
    $(“#btnDailySave”)
    .click(
    function() {
    $.ajax(
    {
    url : “saveDailyEntry.htm,
    cache : false,
    type : “POST”,
    contentType:’application/json;charset=utf-8′,
    async : false,
    dataType : “json”,
    data : JSON.stringify(editedRow)
    })
    .done(
    function(data) {
    alert(“Daily based TS Entry data saved essfully.”);
    $(
    ‘#jqxgridDaily’)
    .trigger(
    ‘reloadGrid’);
    }).fail(function() {
    alert(“Daily based TS Entry not saved. Please try after some time”);
    });
    <strong>dailysrc.localdata = dailyData;
    $(“#jqxgridDaily”).jqxGrid(‘updatebounddata’);
    dataAdapter.dataBind();</strong>
    }
    }

    });
    });`

    Refresh grid after ajax save #50560

    Dimitar
    Participant

    Hello ssp,

    The updatebounddata and the other code you put after the Ajax call should be called in the done callback function. This way, you will be sure the data source has finished updating before re-binding the grid.

    Best Regards,
    Dimitar

    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.