Going goggle-eyed and bald over this having spent ages looking at many references, including ZF docs and MWO's helpful but ancient review at http://weierophinney.net/matthew/archives/198-Autocompletion-with-Zend-Framework-and-Dojo.html.

I want to display a Dojo combobox digit populated with an array delivered as Zend_Dojo_Data(). Combobox displays okay, complete with formatting - but the dropdown is not populated. Tried many variations without success. Please, where am I going wrong?

TIA,

Mike A.


Code (not sure if this will render properly on list)...

In main Bootstrap.php...
protected function _initGlobalViewHelpers(){

   $this->bootstrap('view');
   $view = $this->getResource('view');
   $view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
   return $view;

}
In IndexController.php...
public function init(){

   $form = new Zend_Dojo_Form ();
   $form -> addElement(

       'ComboBox',
       'city',
       array (

           'label' => 'City',
           'storeId' => 'cityStore',
           'storeType' => 'dojo.data.ItemFileReadStore',
           'storeParams' => array ('url' => '/city-store/'),
           'dijitParams' => array ( 'searchAttr' => 'name')
           )

   );
   $this->view->form4 = $form;

}
public function cityStoreAction(){

   
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->setNoRender(1);
   Zend_Layout::getMvcInstance()->disableLayout();
   $data = array(

       array('id'=>1, 'name'=>'London'),
       array('id'=>2, 'name'=>'Edinburgh'),
       array('id'=>3, 'name'=>'Guangzhou'),
       array ('id'=>4, 'name'=>'Dublin'),
       array ('id'=>4, 'name'=>'New York'),
       array ('id'=>4, 'name'=>'Los Angeles')
       );

   $dojoData = new Zend_Dojo_Data('id', $data);
   echo $dojoData;

}

In view script index.phtml...
echo $this->form4;

In main layout default.phtml...
[head section]
if ($this->dojo()->isEnabled()){

   $this->dojo()->setLocalPath('js/dojo/dojo/dojo.js')
   ->addStyleSheetModule('dijit.themes.tundra');
   echo $this->dojo();

}
[body section]
body tag class is tundra
simple content echo in the normal way - no frills

Reply via email to