我需要 jqgrid 在准备好时加载数据。所以我有一个名为 LoadData()
的函数,并绑定(bind)按钮的单击事件并编写 $("#btn")。 click()
当ready事件下来时不使用它。
当我单击该按钮时,它就会被使用。 我尝试制作一个点击事件的计时器。也用了。所以我认为当我使用 loadData 函数时,jqgrid 还没有准备好。我怎么知道 Jqgrid 已经准备好?
function LoadData() {
var PSCode = $("#sel_pollutant").val();
var RegionCode = $("#RegionCode").val();
$("#table_list_query").jqGrid('setGridParam', {
url: "TransferEfficiencvData.ashx",
datatype: 'json',
postData: { "Action": "TransferEfficiencv", "RegionCode": RegionCode, "PSCode": PSCode },
page: 1
}).trigger("reloadGrid");
}
$(function(){
var option = {
//jqgrid config
}
$("#table_list_query").jqGrid(option);
$("#btn").click(function () {
LoadData();
});
})
最佳答案
jQgrid中有两个事件可以检查jQgrid是否准备好。他们是,
- 网格完成
This fires after all the data is loaded into the grid and all other processes are complete. Also the event fires independent from the datatype parameter and after sorting paging and etc.
gridComplete: function(){
alert("grid completed");
}
- 加载完成
This event is executed immediately after every server request. data Data from the response depending on datatype grid parameter
loadComplete: function(data)
{
if(data != null){
alert("load completed");
}
},
关于javascript - 我怎么知道 Jqgrid 已经准备好?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36904857/