Skip to content

Instantly share code, notes, and snippets.

Created September 10, 2011 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1208360 to your computer and use it in GitHub Desktop.
Save anonymous/1208360 to your computer and use it in GitHub Desktop.
<div class="span-11">
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'item-grid',
'dataProvider' => $modelA->search(),
'filter' => $modelA,
'columns' => array(
array(
'name' => 'name',
'type' => 'raw',
'value' => '$data->name',
'filter' => CHtml::activeTextField($modelA, 'name'),
),
...
array
(
'class' => 'CButtonColumn',
'template' => '{add}',
'buttons' => array
(
'add' => array
(
'label' => 'Add',
'url' => 'Yii::app()->controller->createUrl("insertItem", array("id"=>$data->primaryKey))',
),
),
),
),
));
?>
</div>
<div class="span-12">
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'trn-grid',
'dataProvider' => $modelB->search(),
'columns' => array(
array(
'name' => 'No.',
'value' => '$row + 1', //count rows
'htmlOptions' => array('style' => 'text-align: right',),
),
...
array
(
'class' => 'CButtonColumn',
'template' => '{delete}',
'buttons' => array
(
'delete' => array
(
'label' => 'Delete',
'imageUrl' => Yii::app()->request->baseUrl . '/images/delete.png',
'url' => 'Yii::app()->controller->createUrl("delete", array("id"=>$data->primaryKey))',
),
),
),
),
));
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment