【发布时间】:2012-05-09 11:48:20
【问题描述】:
我正在使用 Yii 1.1 来实现主详细信息 order-order-details 网格 到目前为止,我得到了他的: - 基本上当我单击详细信息图标(左图标)时 - 它使用 ajax 加载带有详细信息的详细信息网格(我为此使用了一个名为 EAjaxLinkColumn 的组件 - 默认情况下,链接列不支持 ajax)
这是我的代码:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'main-orders-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array (
'class'=>'EAjaxLinkColumn',
'header'=>'Details',
'url'=>Yii::app()->createUrl('mainOrdersDetails/detailview'),
'imageUrl'=>Yii::app()->request->baseUrl.'/images/zoom_in.png',
//linkAjaxOptions and linkAjaxOptionsExpression are merged together, so only put the ones
//that actually need to be evaluated in the latter
'linkAjaxOptions' => array(
'type' => 'POST',
/*'dataType' => 'json', */
'update'=>'#id_view',
),
//In this expression, the variable $row the row number (zero-based);
//$data the data model for the row; and $this the column object.
'linkAjaxOptionsExpression' => array(
'data' => array(
'id' => '$data->id' //note that $data->id is an expression so must be quoted
),
),
),
'id',
'storageF.name',
'date_added',
'order_number',
'expected_ship_date',
'shipped_date',
'shipping_costs',
'personF.user',
'date_to_pay',
'paid_integraly',
'paid_partialy',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
我想要在每一行下方加载它的详细信息。好吧,我不知道该怎么做..因为 CGridView 小部件对于像我这样在 Yii 的初学者来说非常奇怪 现在它总是加载到同一个 div .. 注意
'linkAjaxOptions' => 数组( '类型' => 'POST', '更新'=>'#id_view', ),
首先更新选项是静态的。我想使用 ID #id_view_1 #id_view_2 然后以某种方式在每个主行下方插入那些空行
也许我可以直接使用 Jquery 而不会使 CGrid 的选项复杂化?
【问题讨论】:
-
这是什么#id_view?是 CListView 吗?
-
是一个简单的 div,另一个 CGrid 从 ajax 加载
标签: jquery ajax grid widget yii