El problema que tengo es que cuando le paso un CArrayDataProvider al ‘zii.widgets.grid.CGridView’ me sale el siguiente error
PHP Error
Descripción
Undefined index: id
Archivo Fuente:
/media/Trabajo/Yever/Work/Aplicaciones/yii/framework/web/CArrayDataProvider.php(89)
00077: else
00078: return $this->rawData;
00079: }
00080:
00081: /**
00082: * Fetches the data item keys from the persistent data storage.
00083: * @return array list of data item keys.
00084: */
00085: protected function fetchKeys()
00086: {
00087: $keys=array();
00088: foreach($this->getData() as $i=>$data)
00089: $keys[$i]=is_object($data) ? $data->{$this->keyField} : $data[$this->keyField];
00090: return $keys;
00091: }
00092:
00093: /**
00094: * Calculates the total number of data items.
00095: * This method simply returns the number of elements in {@link rawData}.
00096: * @return integer the total number of data items.
00097: */
00098: protected function calculateTotalItemCount()
00099: {
00100: return count($this->rawData);
00101: }
-----------------Con este arreglo lleno el CArrayDataProvider
$done[ ]= array(‘fecha’=>$fecha, ‘first’=>$p[‘anombre’], ‘second’=>$p[‘nombre’]);
-----------------Creo mi CArrayDataProvider
$dataProvider=new CArrayDataProvider($rawData,array('id'=>'lolo', 'pagination'=>array(
'pageSize'=>10,),)
);
---------------El grid que muestro en la vista y le paso el CArrayDataProvider
$this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'guardias',
'dataProvider' => $dataProvider,
'columns' => array('fecha', 'first', 'second'),
));