Hi,
I have a really weird problem with a view script and Zend_Dojo_Data. I
build an autocompletion form with the approach Matthew described here. I
use the reusable custom QueryReadStore class extension for this.
http://weierophinney.net/matthew/index.php?url=archives/198-Autocompletion-with-Zend-Framework-and-Dojo.html
My view script autocompletion.phtml looks like this:
---------------------------------------------------------
<?
$this->layout()->disableLayout();
$data = new Zend_Dojo_Data('id', $this->data, 'name');
echo Zend_Json::encode($data->toArray());
?>
---------------------------------------------------------
With this dynamic view script the autocompletion does not work. When I
enter any input into the autocompletion form field nothing happens.
Now I changed the autocompletion.phtml file and added some static output:
---------------------------------------------------------
<?
$this->layout()->disableLayout();
?>
{"identifier":"id","items":[{"id":"1","name":"Pizza
Margarita"},{"id":"2","name":"Pizza Hawaii"},{"id":"3","name":"Pizza
Salami"},{"id":"4","name":"Pizza Vegetale"},{"id":"5","name":"Pizza
Kaugummi"},{"id":"19","name":"Pizza Funghi"},{"id":"20","name":"Pizza
ala Luigi"}],"label":"name"}
---------------------------------------------------------
With this hardcoded view script the autocompletion does work as
expected. I don't really understand this. When I call the action method
directly via /index/autocomplete?q=Pizza the output is the same for both
the dynamic and static view script. Also the headers sent are the same.
Has anyone any idea why this is happening? I don't see any real
difference between the dynamic and the static output in the view script
except that the autocompletion does not work for the dynamic version but
does work for the static one?
Thanks and best regards,
Ralf