Hi, I've very new to Dojo - and have just started using it with Zend_Dojo with Zend Framework.
I've just been trying to do some very simple tests, but have found something that I'm certain can't be right... My page uses dojo.data.ItemFileReadStore pointing at a URL to retrieve values for a filtering select.
It's all fine when the URL returns the following JSON string:
{ 'identifier': 'abbr', 'label': 'name', 'items': [ { 'abbr':'ec', 'name':'Ecuador', 'capital':'Quito' }, { 'abbr':'eg', 'name':'Egypt', 'capital':'Cairo' }, ]}
However, if I change the name of the 'name' attribute to something else (see below) - the filtering select refuses to display anything in the filtering select.
{ 'identifier': 'abbr', 'label': 'namer', 'items': [ { 'abbr':'ec', 'namer':'Ecuador', 'capital':'Quito' }, { 'abbr':'eg', 'namer':'Egypt', 'capital':'Cairo' }, ]}
I've done the same with a few examples and had the same behaviour.
Do you have to use the attribute 'name' in each item for the human readable display? I've read in several docs that the label attribute should actually specify what attribute should be used for display.
Any help/spots of glaring obvious errors would be appreciated!

you're probably not setting
you're probably not setting the searchAttr and/or labelAttr property properly for the filteringSelect. these properties are what tells the filteringSelect which fields to search and display.
if you're unsure of how to set these properties, post the code with the declaration of the widget so you can get help.
OK, i'm not sure if this is
OK, i'm not sure if this is going to appear formatted correctly, but here's the declaration from my form class:
$this->_form->addElement('ComboBox', 'keywords', array('label'=>'Keywords',
'autocomplete'=>true,
'storeId'=>'existingQuestions',
'storeType'=>'dojo.data.ItemFileReadStore',
'storeParams'=>array(
'url'=>'/default/application/ajax-existing-questions/?format=json',
'dijitParams'=>
array(
'searchAttr'=>'questionContext',
'labelAttr'=>'questionContext'
)
)
)
)
When clicking / typing on the filtering select: the repsonse from the /default/application/ajax-existing-questions/?format=json script is:
{ identifier:'name',
'items':[
{ 'name':'40', 'questionContext':'qw' },
{ 'name':'41', 'questionContext':'qw' },
{ 'name':'45', 'questionContext':'What is your first name?' }
] }