yii bootstrap + widget TbButtonColumn + widget TbButtonGroup -
yii bootstrap + widget tbbuttoncolumn + widget tbbuttongroup
faced such problem:
table formed widget tbgridview bootstrap (from yii-booster). in column tbbuttoncolumn form "edit / delete, etc."
but 1 button want effect of split dropdowns http://yii-booster.clevertech.biz/components.html#buttondropdowns
$this->widget('bootstrap.widgets.tbgridview', array( 'id'=>'customer-grid', 'type'=>'striped bordered condensed', 'dataprovider'=>$model->search(), 'filter'=>$model, 'columns'=>array( 'surname', 'name', 'middlename', 'dateofbirth', array( 'class'=>'bootstrap.widgets.tbbuttoncolumn', 'template'=>'{add} {list} {update} {print_act}', 'buttons'=>array ( 'add' => array ( 'label'=>'Назначить прием', 'icon'=>'plus', 'url'=>'yii::app()->createurl("reception/create", array("id"=>$data->id))', 'options'=>array( 'class'=>'btn btn-small', ), ), 'list' => array ( 'label'=>'Список предоставленных услуг', 'icon'=>'list white', 'url'=>'yii::app()->createurl("patient/update", array("id"=>$data->id))', 'options'=>array( 'class'=>'btn btn-small btn-info', ), ), 'update' => array ( 'label'=>'Изменить данные Пациента', 'icon'=>'pencil white', 'url'=>'yii::app()->createurl("customer/update", array("id"=>$data->id))', 'options'=>array( 'class'=>'btn btn-small btn-success', ), ), 'print_act' => array ( 'label'=>'Печать акта выполненных работ', 'icon'=>'print', 'url'=>'yii::app()->createurl("customer/printact", array("id"=>$data->id))', 'options'=>array( 'class'=>'btn btn-small', ), ), ), 'htmloptions'=>array( 'style'=>'width: 220px', ), ) ), ));
i've found when need render complex element in gridview (especially widget) it's easier if call function controller. example gridview have columns defined this:
'columns'=>array( 'surname', 'name', 'middlename', 'dateofbirth' ... array( 'name'=>'fieldname', //call function 'renderbuttons' current controller 'value'=>array($this,'renderbuttons'), ), ) and in action this. renders example widget yii-booster example page http://yii-booster.clevertech.biz/components.html#buttondropdowns:
edit: helpful because of callback function renderbuttons() accepts 2 parameters: $data , $row. can use $data access data gridview's data provider in order dynamically render widget.
public function renderbuttons($data, $row) { $this->widget('bootstrap.widgets.tbbuttongroup', array( 'size'=>'large', 'type'=>'inverse', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse' 'buttons'=>array( array('label'=>'inverse', 'items'=>array( array('label'=>'action', 'url'=>'#'), array('label'=>'another action', 'url'=>'#'), array('label'=>'something else', 'url'=>'#'), '---', array('label'=>'separate link', 'url'=>'#'), )), ), )); }
Comments
Post a Comment