Can I please get what makes up the URL: { url:
"/data/lookup/table/city/filterName/countryId/filterValue/" +
dijit.byId("countryId").value }??

My first table name is 'region' wth the ff fields: id, name and the second
is 'site' with: id, site_name.

I only understand up to the 'lookup' part in the URL which is the controller
action to output JSON. From 'table' to 'filterValue' in the URL is abit
confusing so llitle explaination will help to understand how the URL was
derived and the correct URL to put in.

Counting on your quick response.

Thanks 



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-tp25269984p26309473.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to