1

我想将数据附加到 jqgrid,所以当用户点击查看更多按钮时,它会加载通过 JSON 请求检索到的其他数据。

html

  <div id="SeeMoreSearchResultsDiv" class="scroll" style="text-align: center;">
            <div id="ancSearchResultsSeeMore" class="grayButton" style="float: left; left: 350px;">            <ul> 
                <li class="ltImg"></li> 
               <li><a href="#" onclick="seeMoreFunction()">See more</a></li>
                   <li class="rtImg"></li> 
                  </ul> </div>
 </div> 

这是我的网格

   jQuery("#SearchResultDataGrid").jqGrid({
url: updatedURL,
datatype: "json",
ajaxGridOptions: { contentType: "application/json" },
jsonReader: {
    id: "CTSID",
    cell: "",
    root: function (obj) { return obj.Results; },
    page: function () { return 1; },
    total: function (obj) { return obj.Count; },
    records: function (obj) { return obj.length; },
    repeatitems: false
},
colNames: ['CTS ID', 'Name', 'City', 'Type', 'Status', 'Platinum ID', 'RSM Group Code'],
colModel: [{ name: 'CTSID', index: 'CTSID', width: 40, align: "center" },{ name: 'CustomerName', index: 'CustomerName', width: 150, align: "center" }, { name: 'CityAndState', index: 'CityAndState', width: 90, align: "center" }, { name: 'CustomerTypeName', index: 'CustomerTypeName', width: 50, align: "center" }, { name: 'CustomerStatusName', index: 'CustomerStatusName', width: 50, align: "center" }, { name: 'PlatinumID', index: 'PlatinumID', width: 50, align: "center" },{ name: 'RSMGroupCode', index: 'RSMGroupCode', width: 100, align: "center" }],
pager: false,
rowNum: -1,
//  rowList:[25,50,75,100],
sortorder: "asc",
autowidth: true,
viewrecords: true,
shrinkToFit: true,
rownumbers: false,
clearGridriData: false,
gridview: true,
caption: false});

这就是我所说的

 function seeMoreFunction() { 
         page = page + 1; updatedURL = updateSearchString(" "); refreshGrid();
        }
     function refreshGrid() 
      { $('#SearchResultDataGrid').setGridParam({ url: null });    $('#SearchResultDataGrid').setGridParam({ url: updatedURL }); $('#SearchResultDataGrid').trigger('reloadGrid'); 
} 

我验证了 JSON 请求,它们是正确的,但问题是我无法附加到现有数据。我已禁用 clearGridData。

任何帮助,将不胜感激。

4

0 回答 0