Hi guys , im trying to create a personal access controll sistem , i’m listing all my crontrollers and models in a table, but i need the table to work with the CArrayDataProvider type , my table is like this:
$this->widget(
'bootstrap.widgets.TbGridView',
array(
'type' => 'striped bordered',
'dataProvider' => $dataprovider,
'template' => "{items}\n{pager}",
'columns' => array(
array('name' => 'modulo', 'header' => 'Módulo'),
array(
'name' => 'acao',
'header' => 'Ação',
),
array(
'class' => 'bootstrap.widgets.TbToggleColumn',
'toggleAction' => 'example/toggle',
'name' => 'status',
'header' => 'Toggle'
),
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
'template'=>'{aceitar}',
'buttons'=>array
(
'aceitar' => array
(
'label'=>'Aceitar',
'imageUrl'=>Yii::app()->request->baseUrl.'/img/check.png',
//'url'=> '#',
),
),
),
)
)
);
the dataProvider is like:
CArrayDataProvider Object
(
[keyField] => status
[rawData] => Array
(
[0] => Array
(
[modulo] => acl
[acao] => actionIndex
[status] => 0
)
[1] => Array
(
[modulo] => animais
[acao] => actionView
[status] => 0
)
[2] => Array
(
[modulo] => animais
[acao] => actionCreate
[status] => 0
)
[3] => Array
(
[modulo] => animais
[acao] => actionUpdate
[status] => 0
)
[4] => Array
(
[modulo] => animais
[acao] => actionDelete
[status] => 0
)
[5] => Array
(
[modulo] => animais
[acao] => actionIndex
[status] => 0
)
[6] => Array
(
[modulo] => animais
[acao] => actionAdmin
[status] => 0
)
[7] => Array
(
[modulo] => animais
[acao] => actionIndex
[status] => 0
)
)
[caseSensitiveSort] => 1
[_id:CDataProvider:private] => id
[_data:CDataProvider:private] =>
[_keys:CDataProvider:private] =>
[_totalItemCount:CDataProvider:private] =>
[_sort:CDataProvider:private] =>
[_pagination:CDataProvider:private] => CPagination Object
(
[pageVar] => id_page
[route] =>
[params] =>
[validateCurrentPage] => 1
[_pageSize:CPagination:private] => 10
[_itemCount:CPagination:private] => 0
[_currentPage:CPagination:private] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
If i dont use the togle button column the code works fine , but when i put the togle column it shows this error: Trying to get property of non-object
C:\xampp\htdocs\yiinovo\framework\base\CComponent.php(612) : eval()'d code(1)
…
help me i realy need to use togle ,with arraydata provider , please help me i need to create this table to edit the permissions of the users.
Thanks Yii community.