每次加载我的jqxgrid时,问题都会显示在Google Chrome浏览器控制台日志中,
每次页面加载并且Google Chrome浏览器控制台日志显示错误消息时,我的jqxgrid都不会停止显示加载器(永远加载)。
未捕获的TypeError:无法读取未定义的属性'beginupdate'
我尝试重命名id及其变量名,因为它可能会发生冲突。但是这些似乎都不起作用。
我的jqx网格的代码段
// select rows.
var rowsGrab = $("#table tbody tr");
// select columns.
var columnsGrab = $("#table thead th");
var data = [];
for (var i = 0; i < rowsGrab.length; i++) {
var row = rowsGrab[i];
var datarow = {};
for (var j = 0; j < columnsGrab.length; j++) {
// get column's title.
var columnName = $.trim($(columnsGrab[j]).text());
// select cell.
var cell = $(row).find('td:eq(' + j + ')');
datarow[columnName] = $.trim(cell.text());
}
data[data.length] = datarow;
}
var grabSource = {
localdata: data,
datatype: "array",
datafields:
[
{ name: "Code", type: "string" },
{ name: "Provider", type: "string" },
{ name: "Description", type: "string" },
{ name: "Status", type: "string" },
],
sortcolumn: 'Status',
sortdirection: 'asc'
};
var dataAdapter = new $.jqx.dataAdapter(grabSource, {
loadComplete: function (data) { },
loadError: function (xhr, status, error) { }
});
$("#grid-grab").jqxGrid({
width: "99%",
source: dataAdapter,
columnsresize: true,
autoheight: true,
sortable: true,
showfilterrow: true,
filterable: true,
pageable: true,
selectionmode: "singlecell",
columns: [
{ text: 'Code', dataField: 'Code', align: 'center', width: "30%",filtertype: 'input',cellsalign: 'center'},
{ text: 'Provider', dataField: 'Provider', align: 'center', width: "20%",filtertype: 'input',cellsalign: 'center'},
{ text: 'Description', dataField: 'Description', align: 'center', width: "30%",filtertype: 'input',cellsalign: 'center'},
{ text: 'Status', dataField: 'Status', align: 'center', filtertype: 'checkedlist', width: "20%",cellsalign: 'center',}
]
});
$('#clearfilteringbutton-grab').click(function () {
$("#grid-grab").jqxGrid('clearfilters');
});
$("#table").css("display","none");
//this wasn't able to work because of error encounter above.
这是jqxGrid实施的地方。
//jqx will pull values here using its table id
<div id="voucher-list" class="tab-pane fade">
<table class="table table-striped" id="table">
<thead>
<tr>
<th>Code</th>
<th>Provider</th>
<th>Description</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>QWE123</td>
<td>Manager</td>
<td>500 off</td>
<td>Active</td>
</tr>
<tr>
<td>ASD456</td>
<td>Staff</td>
<td>1500 off</td>
<td>USED</td>
</tr>
</tbody>
</table>
</div>
<div id="grid-grab"> </div>
此代码的结果部分起作用,因为显示了数据,但是当存在大量数据时,加载程序不会消失,也不会发生分页。