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.

yiibooster reference

class reference of cgridview

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

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -