Dynamic url for dojo source combobox

I am trying to use dojo combobox with an Ajax datasource. I have

<div dojoType="dojo.data.ItemFileReadStore" 
     jsId="tags" 
     url="<%=ResolveClientUrl("~/Tag/TagMatches")%>" >
</div>
<select dojoType="dijit.form.ComboBox" 
        store="tags" 
        value="" 
        name="tagName">
</select>

      

Which works, except that I can't limit the search set on the server side because I don't know how to change the url the data is being pulled from to point to the parameter. Any hints?

0
javascript dojo


source to share


2 answers


If you understand correctly, you want the client to download a different dataset from the server based on some general condition defined elsewhere.

In principle, there is no need to pre-define <div>

. You can also create ItemFileReadStore

directly in JavaScript:

earlier...



var tagMatchUrlBase = '<%=ResolveClientUrl("~/Tag/TagMatches")%>';

      

later...

var tagMatchUrl = tagMatchUrlBase + "?f=" + escape(somefilterString);
var store = new dojo.data.ItemFileReadStore({url: tagMatchUrl});
tagName.store = store;
// maybe use store.fetch() to pre-select item #1

      

+1


source to share


This is usually not done with ItemFileReadStore, which is for loading all the data from the front, not filtering on the server.



Rather, you should be using QueryReadStore , JsonReadStore , etc.

0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics