Login Register

Porting 0.4 Combobox with dataUrl to 0.90

In Dojo 0.4 I had a Combobox with the dataUrl set to an url that returned a list of logged on users. The Combobox pulled data from the url each time the drop down arrow was pressed, so it was always up to date. With Dojo 0.9, I`ve set the Combobox to use a datastore, but it only pulls data from the url the first time it is clicked. How can I get it updating every time it is clicked like with Dojo 0.4?

Thanks in advance..

I have the same problem

Basically I have the same problem regarding upgrading comboBox 0.4 to comboBox 0.9. With comboBox 0.4 for Auto Complete, for every character entered in the Text box, a request is being sent to the data provider; in my case I was able to send a request to the Servlet with a parameter that determines my search string dataUrl="/actions/someJSP.jsp?skills=%{searchString}" for example if someone types the character “a” a request is being send the servlet and it would return a JSON file containing all string starting with character “a” which is what I really need, … however with Dojo 0.9 comboBox it seems there is a single call to the data provider and it populates your list and there are no subsequent calls to the data provider, now how would I be able to call the data provider ( jsp/ servlet any server call) for every character that is typed in the input box. Thanks.

upgrading comboBox 0.4 to 0.9

 

I was able to find a workaround until this issues is fixed, basically I modified  JsonItemStore and make sure for every character that is entered in the input box the JsonItemStore does a remote call and retrives the value base on the parameter. I’m using a JSP or Servlet file in a remote server. Basically the JSP or Servlet will get the param and based on the param name and value will return a JSON file format back( make sure you use JSON format for dojo version 0.9), for example if I have a input box for states and the user types “c” my server would return the following format string:


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 


"{identifier:'abbreviation', items: [{name:'<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />California',abbreviation:'California'},{name:'Colorado',abbreviation:'Colorado'},{name:'Connecticut',abbreviation:'Connecticut'}]}"


 


( you may want to rename the JsonItemStore, but make sure you make the correct reference to it)


 


Here is my html code  


<div dojoType="dojo.data.JsonItemStore" jsId="stateStore" url="actions/someJSP.jsp?Param=">


           </div>


      


 <input dojoType="dijit.form.ComboBox"


                store="stateStore"


                searchAttr="name"


                name="state1”


        >


 


( you will have to append the Param value to the url in the JsonItemStore.js)


 


Modify JsonItemStore.js _fetchItems: function


Simply remove this code starting line number 243 to 246


 


                        if(this._loadFinished){


                                    filter(keywordArgs, this._arrayOfAllItems);


                        }else{  // make sure you remove the close ‘}’ at the end


 


Replace the above code by retrieving the argument or what the user has typed in


keywordArgs.query[key]   // need to replace key with a way to see the first element


 


also you may want to remove the “*” at the end of keywordArgs.query[key]


   var va = value.lastIndexOf('*');


   value = value.substr(0, va);


 


then finally modify line 249


from     url: self._jsonFileUrl


to         url: self._jsonFileUrl + value    // value is the string type in input box


I hope this helps

Thanks.

The same problem

I have the same problem. I can't upgrade to 0.9 without possibility to have active 'finder' - I am querying against 100k records so I can't do it on client site. Any progress in implementing server side filtering in 0.9 ? Thanks.