CakePHP and jqGrid -


i using cakephp , jqgrid, having difficult time making them talk nice. can go through trouble of building json response (i know, "it's not difficult" ;)) prefer return flattened version of result find("all"...).

here current code (selecting fields want). there quick , easy way format nicely jqgrid?

$result = $this->contact->find('all', array(                 'fields' => array('first_name', 'last_name', 'company', 'title'),                 'conditions' => array('or' => $filters),                 'offset' => $skip,                 'limit' => $rows                 )); 

thanks in advance!

edit

i able turn results of array jquery wanted it, i'm getting blank table (table renders cells empty). here updated code, ideas?

$result = $this->contact->find('all', $options);  $data = array(); ($i = 0; $i < count($result); $i++) {     $data[$i]['id'] = $result[$i]['contact']['id'];     $data[$i]['cell'] = $result[$i]["contact"]; }  $result = array(     'rows' => $data,     'page' => $page,     'total' => ceil($totalpages / $rows),     'records' => $totalpages ); 

here snip of json:

{    "rows":[       {          "id":"2160",          "cell":{             "first_name":"rory",             "last_name":"johnson",             "company":"somewhere",             "title":"director of engineering",             "id":"2160"          }       },       {          "id":"2297",          "cell":{             "first_name":"steven",             "last_name":"johnson",             "company":"another place",             "title":"dir busn proc desgn",             "id":"2297"          }       }    ],    "page":"1",    "total":"75",    "records":"748" } 

as notice, have associative array cells. ended doing following work:

in php changed array 1 level:

for ($i = 0; $i < count($result); $i++) {     $data[$i] = $result[$i]["contact"]; } 

in javascript changed 1 of default values jsonreader:

...     jsonreader: {        repeatitems: false     }, ... 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -