On Sat, Feb 7, 2009 at 7:54 AM, Matthew Weier O'Phinney <matt...@zend.com>wrote:
> Use Zend_Dojo_Data, which was built precisely for this purpose. :) > > Simply do the following: > > $data = new Zend_Dojo_Data('id', $object->fetchAll(), 'name'); > echo $data; > > I'm assuming that the "fetchAll()" you referenced in the earlier post > was a call to a database adapter or a Zend_Db_Table object; either way, > Zend_Dojo_Data is smart enough to figure it out. > > As some background, the ComboBox and FilteringSelect widgets expect a > dojo.data payload in order to build the options for autocompletion. > dojo.data is an abstracted JSON data format used in Dojo for a variety > of widgets. Zend_Dojo_Data was created to create such structures. Also, if you don't want to mess up any other calls which use that data, you can just pass in a query parameter to tell your action whether or not it should make a dojo.data payload, or "regular" JSON. This is what I'm doing in one of my projects, which has a complete JSON driven API. -- A.J. Brown web | http://ajbrown.org phone | (937) 660-3969