php - Revert Column and Row Yii TbExtendedGridView -
i'm displaying simple table containing 2 headers 'variable' , 'value', display like:
variable| value entry1| value1 entry2| value2 how revert columns , rows make like
variable | entry1 | entry2 value | value1 | value2 my current code:
$this->widget('bootstrap.widgets.tbextendedgridview', array( 'sortablerows'=>true, 'aftersortableupdate' => 'js:function(id, position){ console.log("id: "+id+", position:"+position);}', 'type'=>'striped bordered', 'dataprovider' => $dataprovider, 'columns' => array( array( 'header'=>'variable', 'name'=>'variable_id', 'value'=>'$data->variable->name', 'filter'=>chtml::listdata(study::model()->findall(), 'id', 'variable_name'), ), 'value', ), ));
reading documentation, there isn't 1 way change row columns or vice , versa.
so, should is, create gridview without header or use public property of cgridview hideheader allow hide headers, anyway, have change data display 3 columns instead of 2.
change from:
$data[0][0] = 'entry1'; $data[0][1] = 'value1'; $data[1][0] = 'entry2'; $data[1][1] = 'value2'; $griddataprovider = new carraydataprovider($data); // $gridcolumns header $gridcolumns = array( array('name'=>'variable', 'header'=>'variable'), array('name'=>'value', 'header'=>'value'), ); $this->widget('bootstrap.widgets.tbgridview', array( 'dataprovider'=>$griddataprovider, 'template'=>"{items}", 'columns'=>$gridcolumns, )); to:
$data[0][0] = 'variable'; $data[0][1] = 'entry1'; $data[0][2] = 'value1'; $data[1][0] = 'value'; $data[1][1] = 'entry2'; $data[1][2] = 'value2'; $griddataprovider = new carraydataprovider($data); $this->widget('bootstrap.widgets.tbgridview', array( 'dataprovider'=>$griddataprovider ));
Comments
Post a Comment