JavaScript——Jqgrid調用reloadGrid不刷新的解決辦法

$("#list2").jqGrid({
    url: ctx + '/JSONData',
    datatype: "json",
    colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
    colModel: [
        { name: 'id', index: 'id', width: 55 },
        { name: 'invdate', index: 'invdate', width: 90 },
        { name: 'name', index: 'name asc, invdate', width: 100 },
        { name: 'amount', index: 'amount', width: 80, align: "right" },
        { name: 'tax', index: 'tax', width: 80, align: "right" },
        { name: 'total', index: 'total', width: 80, align: "right" },
        { name: 'note', index: 'note', width: 150, sortable: false }
    ],
    rowNum: 10,
    rowList: [10, 20, 30],
    pager: '#pager2',
    sortname: 'id',
    mtype: "post",
    viewrecords: true,
    reloadAfterSubmit: true, //成功保存記錄後重新加載grid數據
    sortorder: "desc",
    caption: "JSON 實例"
});

添加屬性reloadAfterSubmit: true,
添加 / 更新 / 刪除 jqgrid中的某項後調用方法:

$("#list2").resetSelection(); // 取消表格選中記錄
$("#list2").trigger("reloadGrid");// 刷新整個列表
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章