Zend_Dojo Grid on Zend_Framework PDF Print E-mail
Saturday, 24 January 2009 04:20

Quick

from zendguru.wordpress.com

Zend Dojo Grid

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>
 

Add your comment

Your name:
Your email:
Your website:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:

Ads...

z

Ads...

z

Who's Online

We have 1 guest online

Statistics

Members : 14
Content : 73
Web Links : 7
Content View Hits : 52760