-- Cory D. Wiles <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 10:55 AM -0500):
> Instead of doing the following:
> 
> $this->_helper->viewRenderer-
> 
>     >setNoRender(true);
>        $this->_helper->layout->disableLayout(true);
>        $response = $this->getResponse();
>        $response->setHeader('Content-Type', 'application/json')
>                 ->setBody($f->toJson());
> 
> 
> Would you be able to achieve the same effect by using the ajaxContext switch
> since it by default disables layout and viewRender?

In the next week, you won't need to do any of the above anyways. :)


> On Wed, Jul 2, 2008 at 11:51 AM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
> wrote:
> 
>     -- Fabrice Terrasson <[EMAIL PROTECTED]> wrote
>     (on Wednesday, 02 July 2008, 06:33 PM +0200):
>     > Matthew Weier O'Phinney a écrit :
>     > > Greets, all --
>     > >
>     > > I've committed the complete Zend_Dojo_Data implementation to the
>     > >
>     > Thank you !!!
>     >
>     > What's the handy way to get a proper json ?
>     >
>     > I tried a bit, in my controller:
>     >
>     >     public function autocompleteAction() {
>     >         $p= new Catalogue();
>     >         $rows= $p->fetchAll();
>     >
>     >         $f= new Zend_Dojo_Data();
>     >         $f->setIdentifier('id');
>     >         $f->addItems( $rows );
>     >
>     >         $this->_helper->autoCompleteDojo( $f );
>     >         //echo $f;
>     >     }
> 
>     Well, you've got one big problem here: autoCompleteDojo() isn't yet
>     wrapping Zend_Dojo_Data, so you'll get an inaccurate and invalid
>     structure as you show below.
> 
>     For now, until I refactor autoCompleteDojo(), do this in your action
>     instead:
> 
> 
>        $this->_helper->viewRenderer->setNoRender(true);
>        $this->_helper->layout->disableLayout(true);
>        $response = $this->getResponse();
>        $response->setHeader('Content-Type', 'application/json')
>                 ->setBody($f->toJson());
> 
>     I'll be refactoring autoCompleteDojo() in the coming week to allow
>     passing Zend_Dojo_Data objects, as well as to consume Zend_Dojo_Data to
>     create the payload when other types are passed to it.
> 
>     > I m getting a well formated json file but complicated :
>     > {"identifier":"name",
>     > "items":  [{
>     >     "label": {"id":"1","produit":"pomme"},
>     >     "name": {"id":"1","produit":"pomme"}
>     > },{
>     >     "label": {"id":"2","produit":"orange"},
>     >     "name": {"id":"2","produit":"orange"}
>     > }]}
>     >
>     > I'd prefer and "dojo.data.ItemFileReadStore" too, a simpler json like :
>     > {"identifier": "name",
>     > "items": [{
>     >     "label":"pomme",
>     >     "name":"pomme"
>     > },{
>     >     "label":"orange",
>     >     "name":"orange"}
>     > }]}
>     >
>     > fyi, this is the schema SQL :
>     > CREATE TABLE `catalogue` (
>     >   `id` int(11) NOT NULL auto_increment,
>     >   `produit` varchar(100) NOT NULL,
>     >   PRIMARY KEY  (`id`) );
>     >
>     > FT.
>     >
> 
>     --
>     Matthew Weier O'Phinney
>     Software Architect       | [EMAIL PROTECTED]
>     Zend Framework           | http://framework.zend.com/
> 
> 
> 
> 
> 
> --
> Cory Wiles
> [EMAIL PROTECTED]
> http://www.corywiles.com
> http://www.400mtogo.com

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to