|
Zend_Dojo Grid on Zend_Framework |
|
|
|
|
Saturday, 24 January 2009 04:20 |
Quickfrom zendguru.wordpress.com on model, create function getData() public function getData(){ $select = $this->_db->select()->from($this->_name); $results = $this->getAdapter()->fetchAll($select); return $results; } on controller, create function recordsAction() //nyobo dojo grid public function recordsAction() { $weks = new crpm(); $data = $weks->getData(); $dojoData = new Zend_Dojo_Data('crpm_id',$data,'crpm_id'); echo $dojoData->toJson (); exit (); } doesnt need view for recordAction, there is a exit command, this mean doesnt need view
on view, create view for this... whatever <?php //iki nyobo grid dojo $this->dojo()->enable(); ?> <script type="text/javascript"> dojo.require("dojox.data.QueryReadStore"); dojo.require("dojox.grid.Grid"); dojo.require("dojo.parser"); </script> <div dojoType="dojox.data.QueryReadStore" jsId="activeStore", url="<?php echo $this->baseUrl();?>/default/paymentmethod/records"> </div <div dojoType="dojox.grid.data.DojoData" jsId="model" rowsPerPage="20" store="activeStore"> </div> <table id="activePastes" dojoType="dojox.grid.Grid" model="model" style="height:300px;"> <thead> <tr> <th field="crpm_id">Id</th> <th field="title">Title</th> </tr> </thaead> </table>
|