任何人都可以告诉我如何在gridview中使用jqgrid作为子网格 [英] Can anybody tell me how to use jqgrid as sub grid in gridview

查看:98
本文介绍了任何人都可以告诉我如何在gridview中使用jqgrid作为子网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 $(document).ready(function(){
$( #jqGrid)。jqGrid({
url:' data.json'
mtype: GET
datatype:< span class =code-string> json
colModel:[
{label:' ID',name:' ID',键: true ,宽度: 75 },
{label:' Task_Key',name:' Task_Key',宽度: 150 },
{label:' Process',name:' 处理',宽度: 150 },
{label:' Pending',name:' 待定',宽度: 150 },
{label:' Task_Cd',name:' Task_Cd',width: 150 }
],
loadonce: true
宽度: 780
height: 250
rowNum:< span class =code-digit> 10 ,
s ortname:' CustomerID'
jsonReader:{
// 指示子网格将数据作为名称:值对
subgrid:{repeatitems: false }
},
subGrid: true / / 将subGrid属性设置为true以显示每行的展开按钮
subgridtype:' json' // 设置子网格类型to json
subGridUrl:function( params ){ // url可以是一个函数。在这种情况下,我们根据id行构建网址
return params .id + ' 。json';
},
// 子网格模型的描述
subGridModel :[{
name:[ BO NO BO Date 客户名称 Mobile NO 试用日期 样式 数量 处理速度],
宽度:[ 60 180 150 100 , 70 ],
align:[ left left left left right],
params false
}],
pager: #jqGridPager
});
});
< / script >

解决方案

(document).ready(function(){


#jqGrid)。jqGrid({
url:' data.json'
mtype: GET
数据类型: json
colModel:[
{label:' ID',name:< span class =code-string>' ID',key: true ,width : 75 },
{label:' Task_Key',name:' Task_Key',width: 150 },
{label:' Process',name:' Process',width: 150 },
{label:' 待定',name:' 待定',宽度: 150 },
{标签:' Task_Cd',名称:' Task_Cd',width: 150 }
],
loadonce: true
宽度: 780
height: 250
rowNum: 10
sortname:' CustomerID'
jsonReader:{
// 指示子网格将数据作为名称:值对
subgrid:{repeatitems: false }
},
subGrid: true // 将subGrid属性设置为true以显示每行的展开按钮
subgridtype:' json' // 将子网格类型设置为json
subGridUrl: function( params ){ // 网址可以是功能。在这种情况下,我们根据id行构建网址
return params .id + ' 。json';
},
// 子网格模型的描述
subGridModel :[{
name:[ BO NO BO Date 客户名称 Mobile NO 试用日期 样式 数量 处理速度],
宽度:[ 60 180 150 100 , 70 ],
align:[ left left left left right],
params false
}],
pager: #jqGridPager
});
});
< / script >


$(document).ready(function () {
         $("#jqGrid").jqGrid({
             url: 'data.json',
             mtype: "GET",
             datatype: "json",
             colModel: [
                 { label: 'ID', name: 'ID', key: true, width: 75 },
                 { label: 'Task_Key', name: 'Task_Key', width: 150 },
                 { label: 'Process ', name: 'Process', width: 150 },
                 { label: 'Pending', name: 'Pending', width: 150 },
                 { label: 'Task_Cd', name: 'Task_Cd', width: 150 }
             ],
             loadonce: true,
             width: 780,
             height: 250,
             rowNum: 10,
             sortname: 'CustomerID',
             jsonReader: {
                 // instruct subgrid to get the data as name:value pair
                 subgrid: { repeatitems: false }
             },
             subGrid: true, // set the subGrid property to true to show expand buttons for each row
             subgridtype: 'json', // set the subgrid type to json
             subGridUrl: function (params) { // the url can be a function. In this case we build the urls depending on the id row
                 return params.id + '.json';
             },
             // description of the subgrid model
             subGridModel: [{
                 name: ["BO NO", "BO Date", "Customer Name", "Mobile NO", "Trial Date","Style","Qty","Process Rate"],
                 width: [60, 180, 150, 100, 70],
                 align: ["left", "left", "left", "left", "right"],
                 params: false
             }],
             pager: "#jqGridPager"
         });
     });
 </script>

解决方案

(document).ready(function () {


("#jqGrid").jqGrid({ url: 'data.json', mtype: "GET", datatype: "json", colModel: [ { label: 'ID', name: 'ID', key: true, width: 75 }, { label: 'Task_Key', name: 'Task_Key', width: 150 }, { label: 'Process ', name: 'Process', width: 150 }, { label: 'Pending', name: 'Pending', width: 150 }, { label: 'Task_Cd', name: 'Task_Cd', width: 150 } ], loadonce: true, width: 780, height: 250, rowNum: 10, sortname: 'CustomerID', jsonReader: { // instruct subgrid to get the data as name:value pair subgrid: { repeatitems: false } }, subGrid: true, // set the subGrid property to true to show expand buttons for each row subgridtype: 'json', // set the subgrid type to json subGridUrl: function (params) { // the url can be a function. In this case we build the urls depending on the id row return params.id + '.json'; }, // description of the subgrid model subGridModel: [{ name: ["BO NO", "BO Date", "Customer Name", "Mobile NO", "Trial Date","Style","Qty","Process Rate"], width: [60, 180, 150, 100, 70], align: ["left", "left", "left", "left", "right"], params: false }], pager: "#jqGridPager" }); }); </script>


这篇关于任何人都可以告诉我如何在gridview中使用jqgrid作为子网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆