The format is quite different than what I expected. Why are all of the items
repeated twice? Also the identifier was changed from "id" to "name". This
output is very different than if I were to say $data->toJson(), The problem
seems to have been fixed in ZF 1.7 however. I switched my library to point
to 1.7.2 and all seems to be working.

Thanks for your reply.

Barry


Matthew Weier O'Phinney-3 wrote:
> 
> -- barry hembree <[email protected]> wrote
> (on Wednesday, 21 January 2009, 08:12 AM -0800):
>> 
>> Hi All,
>> 
>> I am trying to setup an autocomplete filtering select box. I have an
>> action
>> in my controller like this:
>> 
>>  public function countryAction() 
>>     {
>>         $db = Zend_Registry::get('db');
>>         $sql = 'SELECT id, name FROM country';
>>         $countries = $db->fetchAll($sql);
>>         $data = new Zend_Dojo_Data('id', $countries);
>>         $this->_helper->autoCompleteDojo($data->toArray());
>>     }
>> 
>> $data->toArray() looks like this:
>> 
>> array
>>   'identifier' => string 'id' (length=2)
>>   'items' => 
>>     array
>>       0 => 
>>         array
>>           'id' => int 1
>>           'name' => string 'Argentina' (length=9)
>>       1 => 
>>         array
>>           'id' => int 2
>>           'name' => string 'Australia' (length=9)
>>       2 => 
>>         array
>>           'id' => int 3
>>           'name' => string 'Canada' (length=6)
>>       3 => 
>>         array
>>           'id' => int 4
>>           'name' => string 'Chile' (length=5)
>>       4 => 
>>         array
>>           'id' => int 5
>>           'name' => string 'France' (length=6)
>>       5 => 
>>         array
>>           'id' => int 6
>>           'name' => string 'Germany' (length=7)
>>       6 => 
>>         array
>>           'id' => int 7
>>           'name' => string 'Italy' (length=5)
>>       7 => 
>>         array
>>           'id' => int 8
>>           'name' => string 'New Zealand' (length=11)
>>       8 => 
>>         array
>>           'id' => int 9
>>           'name' => string 'South Africa' (length=12)
>>       9 => 
>>         array
>>           'id' => int 10
>>           'name' => string 'United States' (length=13)
>> 
>> The datastore returned by the call to autoCompleteDojo looks like this:
>> 
>> {"identifier":"name","items":[{"label":"id","name":"id"},{"label":[{"id":1,"name":"Argentina"},{"id":2,"name":"Australia"},{"id":3,"name":"Canada"},{"id":4,"name":"Chile"},{"id":5,"name":"France"},{"id":6,"name":"Germany"},{"id":7,"name":"Italy"},{"id":8,"name":"New
>> Zealand"},{"id":9,"name":"South Africa"},{"id":10,"name":"United
>> States"}],"name":[{"id":1,"name":"Argentina"},{"id":2,"name":"Australia"},{"id":3,"name":"Canada"},{"id":4,"name":"Chile"},{"id":5,"name":"France"},{"id":6,"name":"Germany"},{"id":7,"name":"Italy"},{"id":8,"name":"New
>> Zealand"},{"id":9,"name":"South Africa"},{"id":10,"name":"United
>> States"}]}]}
>> 
>> What the @#$% ?
> 
> What exactly is the issue? That format is a valid dojo.data format...
> Are you expecting something else?
> 
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect       | [email protected]
> Zend Framework           | http://framework.zend.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/autoCompleteDojo---Why-is-this-happening--tp21586360p21593298.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to