array_slice() expects parameter 1 to be array, null given
what is the solution for that?
array_slice() expects parameter 1 to be array, null given
what is the solution for that?
Hi,
Please give us the part of code that causing the error
// this is the data provider
$arrayDataProvider = new CArrayDataProvider(Yii::app()->session->get(‘temp_org_contact’), array(
'id' => 'id',
'sort' => array(
'attributes' => array(
'value', 'type',
),
),
'pagination' => array(
'pageSize' => yii::app()->params['orgPage'],
),
));
then i render it
$controller->render(‘form’, array(
'model' => $model,
'dataProvider' => $dataProvider,
'arrayDataProvider' => $arrayDataProvider,
));
//form
<?php
$this->widget(‘bootstrap.widgets.TbGridView’, array(
'dataProvider' => $arrayDataProvider,
'id' => 'contacts-grid',
'type' => 'striped bordered condensed',
'summaryText' => '',
'columns' => array(
array(
'name' => 'type',
'type' => 'raw',
'value' => 'CHtml::encode($data["type"])'
),
array(
'name' => 'value',
'type' => 'raw',
'value' => 'CHtml::encode($data["value"])',
),
array(
'class' => 'bootstrap.widgets.TbButtonColumn',
'template' => '{delete}',
'htmlOptions' => array('style' => 'width: 50px'),
'buttons' => array(
'delete' => array('url' => 'Yii::app()->createUrl("organizations/organization/DeleteContactList", array("id"=>$data["id"]))'),
)
),
),
));
?>
this is working if at least one record present
but when it is empty is gives ths error
thanks
i think you defind the blank array before code start…
$arrayDataProvider=array()
i hope it’s works…
still get the error when crash clear
Hi,
in your code when page render what is ?
'dataProvider' => $dataProvider,
can you post the full code?
hi ankit i got the point from your post
$sessonArr = array();
(Yii::app()->session->get('temp_org_contact')) ? $sessonArray = Yii::app()->session->get('temp_org_contact') : $sessonArray = $sessonArr;
i did it thanks
cool…