在我的ASP.NETMVC应用程序中,我有JQGrid和它的SubGrid,但是我注意到在onSelectRow
事件中,它没有检测到Subgrid行,直到我展开主网格行。我试图选择主网格行,并在选择时,所有子网格行的复选框应被选中。但它找不到任何子网格。但当我扩张时,它就起作用了。我是否缺少Grid或Subgrid的任何属性?
$("#MyGrid").jqGrid({
datatype: 'local',
colModel: [
{
name: 'ColSelected', label: ' ', width: 40, sortable: false,
formatter: 'checkbox', align: 'center', formatoptions: { disabled: false },
editable: true, edittype: "checkbox", editoptions: { value: "Yes:No", defaultValue: "Yes" }
},
{ name: 'ColName', label: 'Column Name', width: 340, editable: false, sortable: false }],
height: '100%',
autowidth: true,
multiselect: false,
beforeSelectRow: function (rowid, event) {
//some of my code
return true;
},
onSelectRow: function (rowid, status, event) {
//some of my code
},
gridComplete: function () {
//some of my code
},
loadComplete: function () {
//some of my code
},
subGrid: true,
subGridOptions: {
"plusicon": "ui-icon-triangle-1-e",
"minusicon": "ui-icon-triangle-1-s",
"openicon": "ui-icon-arrowreturn-1-e",
"reloadOnExpand": false,
"selectOnExpand": false
},
subGridRowExpanded: function (subgrid_id, row_id) {
var subgrid_table_id = subgrid_id + "_t",
pager_id = "p_" + subgrid_table_id,
localRowData = $(this).jqGrid("getLocalRow", row_id);
$("#" + subgrid_id).html("<table id='" + subgrid_table_id + "'></table><div id='" + pager_id + "'></div>");
$("#" + subgrid_table_id).jqGrid({
datatype: "local",
data: localRowData.LanguageNames,
colNames: [' ', 'Languages'],
colModel: [
{
name: 'ColSelected', label: ' ', width: 40, sortable: false,
formatter: 'checkbox', align: 'center', formatoptions: { disabled: false },
editable: true, edittype: "checkbox", editoptions: { value: "Yes:No", defaultValue: "Yes" }
},
{ name: 'Language', label: 'Languages', align: 'center', width: 150 }
],
idPrefix: "s_" + row_id + "_",
pager: "#" + pager_id,
autowidth: true,
sortname: "num",
sortorder: "asc",
height: "55",
beforeSelectRow: function (rowid, event) {
//some of my code
return true;
},
onSelectRow: function (rowid) //some of my code
},
loadComplete: function () {//some of my code
}
}).jqGrid('navGrid', "#" + pager_id, { edit: false, add: false, del: false });
}
});
1条答案
按热度按时间yks3o0rb1#
如果我正确理解了这个问题,你可以使用选项selectOnExpand和selectOnCollapse(它们是sbgrid选项)。默认情况下,它们为false。
我建议你在这里查阅文档