Hi I need to create table with tbody, tr and td, for example:
<table>
<tbody id="sortable1" class="droptrue">
<tr><td class="ui-state-default">Can be dropped..</td></tr>
<tr><td class="ui-state-default">Can be dropped..</td></tr>
<tr><td class="ui-state-default">Can be dropped..</td></tr>
<tr><td class="ui-state-default">Can be dropped..</td></tr>
</tbody>
</table>
I am using Yii CGridView (this widget required)
$this->widget('bootstrap.widgets.TbGroupGridView', array(
'id'=>'order-table',
'type'=>'striped condensed',
'dataProvider'=>$orders->search(),
'filter'=>$orders,
'ajaxUpdate'=>true,
'columns' =>
array(
array(
'header' => 'ID',
'value' => 'Adminhelper::getRowNumber($row, @$_GET["OrderModel_page"])',
),
'name',
'model',
'imei',
'provider',
array(
'header' => 'payment_type',
'value' => 'Adminhelper::getPaymentMethod($data, array("На счет телефона", "Qiwi", "Webmoney", "На карту Сбербанка", "Yandex Деньги", "PayPal" ))'
),
array(
'header'=>'AAAA',
'value'=>'Adminhelper::getInfoButton($data)',
),
array(
'header'=>'Статус',
'value'=>'Adminhelper::getStatusButton($data)',
),
array(
'header' => 'Copy',
'value'=>'Adminhelper::getCopyButton($data)',
),
array(
'header'=>'Статус',
'value'=>'Adminhelper::getDeleteButton($data)',
),
),
How can I set class and id for tbody tag, and classes for td tag? I didn't found this in CGridView class reference, but I think it can be configuired by htmlOptions. Thanks for help!
Did you try this:
array(
'header'=>'Статус',
'value'=>'Adminhelper::getDeleteButton($data)',
'htmlOptions'=>array('class'=>'td-class-here')
),
For tbody tag you can't define class, but you defined it for table 'id'=>'order-table'
, so you can access to tbody like $('#order-table tbody')
Update: You can't catch ajaxUpdate paging event, but you can use beforeAjaxUpdate, afterAjaxUpdate events, like this:
'afterAjaxUpdate' => 'function(id, data){/*write js-code there*/}'