I need a javascript array of arrays for the autocomplete control.
There are not so much records, so I can fetch them all before, without use 
of ajax inside the autocomplete control.
Following works for me, but I am not sure if this is optimal way (if 2 
steps are necessary):

<script>
var oCustomers = {{=XML(customers.json())}};      // [Object, Object, ..]
aCustomers = [];                                                      // 
[Array[2], Array[2], ..]
for (var i=0; i<oCustomers.length; i++) {
  aCustomers.push([oCustomers[i].name, oCustomers[i].id]);
}
var DS = new YAHOO.util.LocalDataSource( 
<http://yahoo.util.localdatasource%28hledej/>aCustomers);
var AC = new YAHOO.widget.AutoComplete('no_table_c 
<http://yahoo.widget.autocomplete%28%27no_table_hledame/>ustomer', 
'suggestionsDiv', DS);
</script>


Question is if the array of arrays can be created directly, without the 
step with array of objects (1st line of code).

Or additional question if somebody works with YUI2 autocomplete as me:
Can I create json object (and how) and .LocalDataSource( 
<http://yahoo.util.localdatasource%28hledej/>json) directly from this json 
object?

Thanks..., Mirek

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to