Hi,
I have a problem.
I’m trying to make a json_encode in php to provide the grid datas in codeigniter.
This is the controller:
[code]//cargamos el modelo de usuario
$this->load->model(‘user/user’);
if($this->user->get_users_list())
{
//convertimos el array que nos llega en el formato que espera el sistema
$n = 0;
$rows['total_count'] = 2;
$rows['pos'] = 0;
foreach($this->user->_aUsersList as $key => $user)
{
$rows['data'][$n] = $user;
$n++;
}
/*
print('<pre>');
print_r($rows);
print('</pre>');
* */
$data['usersList'] = $rows;[/code]
And this is the JSON result:
{"total_count":2,"pos":0,"data":[{"id":"1","id_group":"1","id_theme":"1","id_languaje":"1","fecha_alta":"2011-05-03 12:00:43","lastLogin":"2011-09-11 07:14:40","name":"Sergio","surname":"Guti\u00e9rrez S\u00e1nchez","email":"s.gutierrez@prisma-mpa.com","password":"d5dec8dd6a7cbe33c3e13dfc672e5cb1","activo":"1"},{"id":"3","id_group":"1","id_theme":"1","id_languaje":"1","fecha_alta":"2011-09-11 08:48:02","lastLogin":"2011-09-11 08:48:02","name":"Ra\u00fal","surname":"Guti\u00e9rrez","email":"info@todokarts.com","password":"7411","activo":"1"}]}
This is the code of grid
[code]
[/code]But i don’t understand what happends. The grid don’t show anything.
Could someone help me?
Kind regards.