I have a problem to use subgrid. I want to use the nice feature 开发者_JAVA技巧of loadoce(local search etc.). And I also want to use subgrid. But it doen't work to put them together. I don't know if it's a bug or I miss some thing.
If I set loadonce:false, the subgrid works.
I tried both 3.7.1 and 3.7.2
Or should I only use one at a time? Many thanks!
This is possible in JQGrid 3.8, at least - and 4.0 (I have not tried JQGrid < 3.8).
Please be certain to have your subGridType
set, if you want to be using loadonce:true
, as that'll override the change from datatype:X
(where X is what you set it to) to datatype:local
(for your subgrid). You probably know you'll have to set editUrl:clientArray
for the local searches to work.
An example from a grid where I'm using the settings you want:
jQuery("#MyGrid").jqGrid({
colNames:['Customer','Value.','Customer ID']
,colModel:[
{name:'customer_name',index:'customer_name',sortable:true},
{name:'value',index:'value',sortable:true,align:'right',width:'100px',formatter:'number',formatoptions:{decimalSeparator:',',thousandsSeparator:'.',decimalPlaces:1,defaultValue:'0.00'}},
{name:'customer_id',index:'customer_id',hidden:true}]
,sortname:'customer_id'
,caption:'mycap'
,datatype:'json'
,loadonce:true
,rowNum:100
,footerrow:true
,pager:false
,userDataOnFooter:true
,sortorder:'asc'
,subGrid:true
,sortable:true
,height:'auto'
,viewrecords:true
,subgridtype:'json'
,url:'?q=1'
,editurl:'?q=1&p=1'
,autowidth:true
,altRows:true
,shrinkToFit:true
,subGridUrl:'/myurl?q=1&sub=1'
,subGridModel:[{name:['Additional Info','Subtotal'],width:[170,60],params:['customer_id']}]
});
精彩评论