[Dojo-interest] Populating Dojo ComboBox with data from backend

Thomas Wolf tw at wsf.at
Wed Jan 31 13:35:25 MST 2007


Doshi, Mehul wrote:
>  
> The Dojo combobox examples don't show how to retrieve data from backend.
> Looks like if I include anything in the dataUri javascript file other
> than the array of array of strings, it doesn't work. How can I
> accomplish this?
> 
> I even tried to point my dataUri to a jsp and servlet, but those don't
> seem to get called.
> 
> If somehow I can add additional code to my javascript file that my
> dataUri points to, then I could use DWR to get my data and populate a
> select option list. Is this even possible to do?
> 

AFAIK the url specified with datUrl just have to return an
appropriate JSON object.

<input dojoType="ComboBox" dataUrl="combo.php" style="width: 300px">

works fine over here, combo.php being:

<?
$list=array();
$list[]=array("eins","e");
$list[]=array("zwei","z");
$list[]=array("drei","d");

print json_encode($list);
?>

HTH
Thomas






More information about the Dojo-interest mailing list