Can please get what makes up the URL: { url:
"/data/lookup/table/city/filterName/countryId/filterValue/" +
dijit.byId("countryId").value }??
I only understand up to the 'lookup' in URL which is the controller action.
>From 'table' in the to 'filterValue' in the URL a llitle explaination will
me to understand how that was derived.
Counting on your quick response.
Thanks
zig2na wrote:
>
> Thanks for your quick responds. I am able to list items using the
> 'Zend_Dojo_Form_Element_FilteringSelect' fields with 'autoCompleteDojo'
> which outputs json in my controller action. What I need now is to
> understand the following line of code so that I can supply the correct URL
> for the filtering to work:
>
> ->setAttrib('onchange', 'dijit.byId("cityId").store = new
> dojo.data.ItemFileReadStore({ url:
> "/data/lookup/table/city/filterName/countryId/filterValue/" +
> dijit.byId("countryId").value });');
>
> The normal URL I use to output the list is: "index/sites" in the second
> field and "index/region" in the first field.
>
> Thanks alot for your help.
>
>
>
>
> denormalized wrote:
>>
>>
>> zig2na wrote:
>>>
>>> Im using Zend_Dojo_Data and in a controller for my datasource but it
>>> still can't filter, Im sure having issues with the onchange
>>> 'dojo.data.ItemFileReadStore ' url. Is possible to break the onchange
>>> url down me, that only seems to be the problem now. Thanks
>>>
>>
>> The onChange url needs to send back a Json-encoded response- basically an
>> array of rows containing name-value pairs passed to Zend_Json_Encoder.
>>
>> In my "data" controller I have a generic "lookup" action. All you need
>> is a model that can return rows of city names and id's.
>>
>> public function lookupAction()
>> {
>> $tableName = $this->_request->getParam('table');
>> $filterName = $this->_request->getParam('filterName');
>> $filterValue = $this->_request->getParam('filterValue');
>>
>> if (empty($tableName))
>> {
>> return;
>> }
>>
>> // TODO: Should be generic for all lookup tables
>> if ('city' === $tableName) {
>> $_model = new NAME_OF_YOUR_CITY_MODEL();
>> // getLookup just returns the rows that match the filter, in this case a
>> countryId
>> $data = $_model->getLookup($filterName, $filterValue);
>>
>>
>> if (null !== $data) {
>> $items = array();
>> foreach ($data as $row) {
>> $items[] = array('label' => $row->name, 'name'
>> => $row->name,
>> 'key' => $row->cityId);
>> }
>> $final = array(
>> 'identifier' => 'key',
>> 'items' => $items,
>> );
>> echo Zend_Json_Encoder::encode($final);
>> }
>> }
>> }
>>
>
>
--
View this message in context:
http://old.nabble.com/How-to%3A--Zend-Dojo-Form-Dependent-Selects-%28e.g.-Country-City%29-tp25269984p26309099.html
Sent from the Zend Framework mailing list archive at Nabble.com.