I hope this won't confuse you more
It's a draft of a datagrid ... take what you need
I hope it will help
http://fsockopen.wordpress.com/2009/07/29/zend-framework-simple-and-dojo-datagrid/
bye
S.
Naimesh.Trivedi (Gmail) ha scritto:
> Hello !
>
> Well I tried creating as mentioned in your code as also setup the dojo as
> per link mentioned above, but I am just able to display labels in blank page
> no data or grid.
> I tried this on zend framework 1.8.4
>
> Please find my code below :
>
> My Bootstrap :
>
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
> {
> protected function _initAutoload()
> {
> $autoloader = new Zend_Application_Module_Autoloader(array(
> 'namespace' => 'Default_',
> 'basePath' => dirname(__FILE__),
> ));
> return $autoloader;
> }
> protected function _initDoctype()
> {
> // $view = new Zend_View();
> $this->bootstrap('view');
> $view = $this->getResource('view');
> $view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
> $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
> $viewRenderer->setView($view);
> Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
> }
> }
>
> My Jobs Model :
>
> class Jobs extends Zend_Db_Table_Abstract
> {
>
> protected $_name='jobs';
>
> public function getJobsData()
> {
> $select = $this->_db->select()->from($this->_name);
> $results = $this->getAdapter()->fetchAll($select);
>
> return $results;
> }
> }
>
> My JobsController script :
> class JobsController extends Zend_Controller_Action
> {
> public function viewAction()
> {
>
> }
>
> public function recordsAction()
> {
> $jobs = new Jobs();
> $data= $jobs->getJobsData();
> $dojoData= new Zend_Dojo_Data('id',$data,'id');
> echo $dojoData->toJson();
> exit;
> }
> }
> My view.phtml script :
>
> //echo $this->baseUrl. "/public/js/dojo/dojo.js";
> // "http://localhost/Zend/js/dojo/dojo/dojo.js"
> // "http://localhost/Zend/js/dojo/dojox/grid/_grid/tundraGrid.css"
> Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
>
> $this->dojo()->setLocalPath("http:localhost:81/dailywork/public/js/dojo/dojo
> .js")
> ->addStyleSheetModule("dijit.themes.tundra")
>
> ->addStylesheet("http:localhost:81/dailywork/public/js/dojox/grid/_grid/tund
> raGrid.css" );
> echo $this->dojo();
> ?>
> <script type="text/javascript">
> dojo.require('dojox.data.QueryReadStore');
> dojo.require('dojox.grid.Grid');
> dojo.require('dojo.parser');
> </script>
> <body class="tundra">
> <div dojoType="dojox.data.QueryReadStore" jsId="activeStore",
> url="http:localhost:81/dailywork/jobs/records"></div>
> <div dojoType="dojox.grid.data.DojoData" jsId="model"
> store="activeStore"></div>
> <table id="activePastes" dojoType="dojox.grid.Grid" model="model"
> rowsPerPage="20" style="height:300px; width:700x;">
> <thead>
> <tr>
> <th field="id">Id</th>
> <th field="title">Title</th>
> <th field="description">Description</th>
> <th field="posted_date">Posted</th> </tr>
> </thead>
> </table>
> </body>
>
> I did copy subfolders in /externals folders of zend framework downloaded. I
> copied dijit, dojo and dojox folders in /public/js folder. My index.php is
> in root above public directory.
> I also tried opening the full URL's for dojo.js and .css files pasting in
> browser, it is opening it, so URL is correct.
>
> Please help me on this.
>
> Thanks In Advance !
>
> Naimesh
>
>
>
>
>
没有评论:
发表评论