【发布时间】:2023-04-11 02:37:01
【问题描述】:
设置:jqGrid 4.4.1
我有一个永远有效的网格。发生了一些变化,数据将不再显示在网格中。网格已加载,但仍显示“正在加载...”通知。
有错误信息是:
Uncaught TypeError: Cannot read property 'stype' of undefined (jquery.jqGrid.src.js:1599)
$.fn.jqGrid.each.addLocalData jquery.jqGrid.src.js:1599
$.fn.jqGrid.each.populate jquery.jqGrid.src.js:1853
(anonymous function) jquery.jqGrid.src.js:2467
f.event.dispatch jquery.min.js:3
f.event.add.h.handle.i jquery.min.js:3
f.event.trigger jquery.min.js:3
(anonymous function) jquery.min.js:3
e.extend.each jquery.min.js:2
e.fn.e.each jquery.min.js:2
f.fn.extend.trigger jquery.min.js:3
$gridManager.addColumnNameToGroupHead gridManager.js:81
$gridManager.setGridOptions gridManager.js:28
$order.showOrders orders.js:112
$.ajax.success orders.js:145
f.Callbacks.o jquery.min.js:2
f.Callbacks.p.fireWith jquery.min.js:2
w jquery.min.js:4
f.support.ajax.f.ajaxTransport.send.d jquery.min.js:4
据我所知,json字符串有效且正确,数据(和列名)匹配,所有stype值都有效。
var searchResultGrid = jQuery("#orderStatus").jqGrid({
datatype: "jsonstring",
datastr: orderData,
jsonReader: { root: 'rows', total: 'total', page: 'page', records: 'records', repeatitems: false, id: 'id' },
colNames: colNames,
colModel: colModel,
rowNum: 5000,
height: $(window).height() - 205,
width: $(window).width()-29,
pagination: true,
pager: '#orderStatusPager',
viewrecords: true,
sortname: 'status',
sortorder: 'desc',
loadonce: true,
sortable: true,
ignoreCase: true,
emptyDataText: "No orders found",
grouping: true,
groupingView: groupingView,
onSelectRow: function (rowId, status) {
{REMOVED FOR CLARITY}
},
loadComplete: function () {
jQuery("#orderStatus").trigger("reloadGrid"); // Call to fix client-side sorting
$gridManager.setGroupingDd("orderStatus", "orderStatusPager", groupCol, ["part_no", "Descript"], "status");
if (orderId) {
jQuery("#orderStatus").setSelection(orderId, true);
}
},
resizeStop: function () { $gridManager.updateGrid("orderStatus", "orderStatusPager"); }
});
如果 colNames 和 colModel 与查找问题相关,我可以提供它们。
这是什么原因造成的?或者,我该如何寻找原因?
更新:
这是groupingView的定义
groupingView = { groupField: [groupCol], groupColumnShow: [$gridManager.isColumnVisible(groupCol)], groupText: ['<b>{0} - {1} Order(s)</b>'], groupCollapse: false, groupOrder: ['desc'] };
我可以看到groupCol 的值为clear,它不是json 字符串中的列。
【问题讨论】:
标签: c# jquery json jqgrid-asp.net