Forum
19:40
19/08/2011
Hi,
I am evaluating jqGrid for a project that we are currently working on. The first task is to integrate jqSuite for PHP into a Zend Framework project. After some debugging this works.
However, I'm currently having the following problem: I'm using the following lines of code (in my Controller) to initialize jqGrid:
$this->_gridConn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
$this->_grid = new jqGridRender($this->_gridConn);
$this->_grid->SelectCommand = 'SELECT id, firma, vorname, nachname, telefon, plz, ort FROM b_kunden';
$this->_grid->table = 'b_kunden';
$this->_grid->dataType = 'json';
$this->_grid->setPrimaryKeyId('id');
$this->_grid->setColModel();
$this->_grid->setUrl('/kunden/fetchdata');
$this->_grid->setGridOptions(array(
"rowNum"=>10,
"rowList"=>array(10,20,30),
"sortname"=>"id"
));
$this->_grid->setColProperty('id', array("editoptions"=>array("readonly"=>true)));
$this->_grid->navigator = true;
$this->_grid->setNavOptions('navigator', array("excel"=>false,"add"=>true,"edit"=>true,"del"=>true,"view"=>true, "search"=>true));
$this->_grid->setNavOptions('edit',array("closeAfterEdit"=>true,"editCaption"=>"Update Customer","bSubmit"=>"Update"));
$this->view->grid = $this->_grid;
The corresponding view simply renders the Grid:
And last but not least, this Action returns the data:
'1' => array('id' => '21', 'firma' => 'test', 'vorname' => 'Andreas', 'nachname' => 'Dreier', 'telefon' => '+43 699 66666666', 'plz' => '9020', 'ort' => 'Klagenfurt'),
'2' => array('id' => '2', 'firma' => 'test', 'vorname' => 'Hubert', 'nachname' => 'Feier', 'telefon' => '+43 699 66666666', 'plz' => '9020', 'ort' => 'Klagenfurt'),
'3' => array('id' => '13', 'firma' => 'test', 'vorname' => 'Horst', 'nachname' => 'Heier', 'telefon' => '+43 699 66666666', 'plz' => '9020', 'ort' => 'Klagenfurt'));
$response['page'] = 1;
$response['total'] = 1;
$response['records'] = 3;
$i=0;
foreach ($rows as $r) {
$response['rows'][$i]['id']=$r['id']; //id
$response['rows'][$i]['cell']=array($r['id'],$r['firma'],$r['vorname'],$r['nachname'],$r['telefon'],$r['plz'],$r['ort']);
$i++;
}
echo Zend_Json::encode($response);
The problem is, that this renders something like:
As you can see, the ID is displayed but all the other data is missing (i.e. not rendered). Any help or hint would be appreciated very much!
Thanks
Christian
Most Users Ever Online: 715
Currently Online:
64 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66