【问题标题】:jqGrid - subgrid doesn't work when load once is truejqGrid - 当加载一次为真时,子网格不起作用
【发布时间】:2010-08-01 20:30:31
【问题描述】:

我在使用 subgrid 时遇到问题。我想使用 loadoce 的好功能(本地搜索等)。而且我也想使用子网格。 但是把它们放在一起是行不通的。我不知道这是一个错误还是我错过了一些东西。

如果我设置 loadonce:false,子网格就可以工作。

我尝试了 3.7.1 和 3.7.2

或者我应该一次只使用一个? 非常感谢!

【问题讨论】:

  • 你找到答案了吗?谢谢

标签: jqgrid subgrid


【解决方案1】:

至少在 JQGrid 3.8 和 4.0 中这是可能的(我还没有尝试过 JQGrid

如果您想使用loadonce:true,请务必设置您的subGridType,因为这将覆盖从datatype:X(其中X 是您设置的)到datatype:local(为您的子网格)。您可能知道必须设置 editUrl:clientArray 才能使本地搜索生效。

我正在使用您想要的设置的网格示例:

   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']}]
    });

【讨论】:

    猜你喜欢
    • 2018-02-06
    • 1970-01-01
    • 2011-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多