C# jqGrid subGridRowExpanded函数工作不正常

C# jqGrid subGridRowExpanded函数工作不正常,c#,jquery,asp.net-mvc,jqgrid,jqgrid-asp.net,C#,Jquery,Asp.net Mvc,Jqgrid,Jqgrid Asp.net,我是jQgrid的初学者,最近几天我尝试学习jQgrid并创建了一个示例 Mvc应用程序。请访问jQgrid网站 我尝试在jQGrid中将网格作为子网格。我想添加,编辑,删除所有功能 子网格是可能的 当我在jQgrid中展开一行时,我面临一个问题,父行没有显示 折叠图标。请看下面我的图片 请看红色的盒子。它没有显示负号图标。请看下面我的代码 <table id="listsg11"> </table> <div id="pagersg11"> </

我是jQgrid的初学者,最近几天我尝试学习jQgrid并创建了一个示例

Mvc应用程序。请访问jQgrid网站

我尝试在jQGrid中将网格作为子网格。我想添加,编辑,删除所有功能

子网格是可能的

当我在jQgrid中展开一行时,我面临一个问题,父行没有显示

折叠图标。请看下面我的图片

请看红色的盒子。它没有显示负号图标。请看下面我的代码

  <table id="listsg11">
</table>
<div id="pagersg11">
</div>
<script type="text/javascript">
    jQuery("#listsg11").jqGrid({
        url: '/Home/DynamicGridData/',
        datatype: "json",
        mtype: 'POST',
        height: 190,
        width: 600,
        colNames: ['Id', 'Votes', 'Title'],
        colModel:
        [
            { name: 'Id', index: 'Id', width: 40, align: 'left' },
            { name: 'Votes', index: 'Votes', width: 40, align: 'left' },
            { name: 'Title', index: 'Title', width: 400, align: 'left' }
        ],
        rowNum: 8,
        rowList: [8, 10, 20, 30],
        pager: '#pagersg11',
        sortname: 'id',
        viewrecords: true,
        sortorder: "desc",
        multiselect: false,
        subGrid: true,
        caption: "Grid as Subgrid"
        ,
        subGridRowExpanded: function (subgrid_id, row_id) {
            // we pass two parameters 
            // subgrid_id is a id of the div tag created whitin a table data 
            // the id of this elemenet is a combination of the "sg_" + id of the row 
            // the row_id is the id of the row 
            // If we wan to pass additinal parameters to the url we can use 
            // a method getRowData(row_id) - which returns associative array in type name-value 
            // here we can easy construct the flowing
            var subgrid_table_id, pager_id;
            subgrid_table_id = subgrid_id + "_t";
            pager_id = "p_" + subgrid_table_id;
            $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + pager_id + "' class='scroll'></div>");
            jQuery("#" + subgrid_table_id).jqGrid({
                url: "/Home/DynamicGridData1/",
                datatype: "json",
                mtype: 'POST',
                colNames: ['Id', 'Votes', 'Title'],
                colModel:
                [
                    { name: 'Id', index: 'Id', width: 40, align: 'left' },
                    { name: 'Votes', index: 'Votes', width: 40, align: 'left' },
                    { name: 'Title', index: 'Title', width: 400, align: 'left' }
                ],
                rowNum: 20,
                rowList: [8, 10, 20, 30],
                pager: pager_id,
                sortname: 'Id',
                sortorder: "asc",
                height: 180,
                width: 500,
            });
            jQuery("#" + subgrid_table_id).jqGrid('navGrid', "#" + pager_id, { edit: true, add: true, del: true })
        }
        //,
        //            subGridRowColapsed: function (subgrid_id, row_id) {
        //                alert(row_id);
        //                // this function is called before removing the data 
        //                //var subgrid_table_id; 
        //                //subgrid_table_id = subgrid_id+"_t"; 
        //                //jQuery("#"+subgrid_table_id).remove();
        //            }
    });
    jQuery("#listsg11").jqGrid('navGrid', '#pagersg11', { add: true, edit: true, del: true });

</script>

jQuery(“#listsg11”).jqGrid({
url:“/Home/DynamicGridData/”,
数据类型:“json”,
mtype:“POST”,
身高:190,
宽度:600,
colNames:['Id','vows','Title'],
colModel:
[
{名称:'Id',索引:'Id',宽度:40,对齐:'left'},
{名称:'投票',索引:'投票',宽度:40,对齐:'左'},
{名称:'Title',索引:'Title',宽度:400,对齐:'left'}
],
rowNum:8,
行列表:[8,10,20,30],
寻呼机:'#寻呼机G11',
sortname:'id',
viewrecords:是的,
巫师:“描述”,
多选:错,
子网格:对,
描述:“网格作为子网格”
,
subGridRowExpanded:函数(subgrid\u id,row\u id){
//我们传递两个参数
//subgrid_id是在表数据中创建的div标记的id
//此elemenet的id是行的“sg_”+id的组合
//row\u id是该行的id
//如果我们想向url传递额外的参数,我们可以使用
//一种方法getRowData(row_id)-返回类型名称值中的关联数组
//在这里,我们可以很容易地构造流
var子网格表id、寻呼机id;
子网格\表\ id=子网格\ id+“\ t”;
pager_id=“p_”+子网格\u表\u id;
$(“#”+子网格_id).html(“”);
jQuery(“#”+子网格_表_id).jqGrid({
url:“/Home/dynamicgridata1/”,
数据类型:“json”,
mtype:“POST”,
colNames:['Id','vows','Title'],
colModel:
[
{名称:'Id',索引:'Id',宽度:40,对齐:'left'},
{名称:'投票',索引:'投票',宽度:40,对齐:'左'},
{名称:'Title',索引:'Title',宽度:400,对齐:'left'}
],
rowNum:20,
行列表:[8,10,20,30],
寻呼机:寻呼机id,
sortname:'Id',
分拣员:“asc”,
身高:180,
宽度:500,
});
jQuery(“#”+子网格_表_id).jqGrid('navGrid',“#”+pager_id,{edit:true,add:true,del:true})
}
//,
//subGridRowColapsed:函数(子网格id,行id){
//警报(行标识);
////在删除数据之前调用此函数
////var subgrid\u table\u id;
////subgrid\u table\u id=subgrid\u id+“\t”;
////jQuery(“#”+子网格_表_id).remove();
//            }
});
jQuery(“#listsg11”).jqGrid('navGrid','#pagersg11',{add:true,edit:true,del:true});

请帮助。

为什么不尝试将javascript放入

$(function(){
//here go the script
});
原因之一是jqgrid尚未正确下载

试试这个

祝你好运