【问题标题】:zfdatagrid and jqgrid: subgrid is not loadingzfdatagrid 和 jqgrid:子网格未加载
【发布时间】:2013-01-27 12:06:34
【问题描述】:

我正在使用 Zend 框架,这就是为什么我决定使用“zfdatagrid deploy jqgrid”而不是直接使用 jqgrid。 我想要 jqgrid 和 subgrid。网格显示正常,但是当我单击展开按钮时,我会收到“正在加载”的通知,但没有任何反应。我已经调试正确调用了“subGridUrl”,因为调试器命中了我应该从 MySQL 中为 subgrid 选择数据的函数,并且我尝试传递纯 json 响应(而不是从 MySQL 中选择),但仍然没有显示 subgrid。也许我不明白必须是什么回应?我的回应:

<...>
$responce = new stdClass();
$responce->rows[0]['id']='0';
$responce->rows[0]['cell']=array('0','test1','123','1');
$responce->rows[1]['id']='1';
$responce->rows[1]['cell']=array('1','test2','321','2');
$j = json_encode($responce);
echo $j;
<...>

【问题讨论】:

    标签: zend-framework jqgrid subgrid zfdatagrid


    【解决方案1】:

    对不起,我的错。但我不会删除我的问题,而是会解释我的错误,以防其他人也会这样做......

    我在声明“subGridModel”时犯了一个错误。而是使用数组:

    $jqGrid->setJqgParams(array(
        'caption' => 'test report',
        <..>
        'subGrid' => true,
        'subGridUrl' => $this->view->url(array('controller'=>'report','action'=>'indexstoragebalancesubgrid'),'default', true),
        'subgridtype' => 'json',
        'loadonce' => false,
        // next line where problem fixed
        'subGridModel' => array(array("name" => array("ID", "Title", "Code", "Quantity"), "width" => array(10,55,200,80)))
        <..>
    ));
    

    我写了字符串:

    'subGridModel'=>'[{name : ["ID", "Title", "Code", "Quantity"], width : [10,55,200,80]}]'
    

    这就是它在 javascript 中不起作用的原因。

    顺便说一句,你可以看到我在数组中写了数组。那是因为使用一个数组 ZFDataGrid 会生成这样的 javascript:

    "subGridModel":{"name":["ID","Title","Code","Quantity"],"width":[10,55,200,80]}
    

    而不是这个:

    "subGridModel":[{"name":["ID","Title","Code","Quantity"],"width":[10,55,200,80]}]
    

    jqgrid subgrid 工作很重要!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多