I'm trying to use a dojo combobox with an Ajax data source. What I have is
我正在尝试使用带有Ajax数据源的dojo组合框。我拥有的是什么
<div dojoType="dojo.data.ItemFileReadStore"
jsId="tags"
url="<%=ResolveClientUrl("~/Tag/TagMatches")%>" >
</div>
<select dojoType="dijit.form.ComboBox"
store="tags"
value=""
name="tagName">
</select>
Which does work except that I can't restrict the search set on the server side because I don't know how to change the url from which the data is pulled in order to specify a parameter. Any hints?
哪个工作除了我不能限制服务器端的搜索集,因为我不知道如何更改从中提取数据的URL以指定参数。任何提示?
2 个解决方案
#1
1
If I understand you correctly, you want the client to load different set of data from the server based on some general condition defined elsewhere.
如果我理解正确,您希望客户端根据其他地方定义的一般条件从服务器加载不同的数据集。
Basically there is no need to have a <div>
pre-defined. You can also create the 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
#2
0
Typically this isn't done with ItemFileReadStore, which is designed to download all the data up front rather than filtering on the server.
通常,这不是使用ItemFileReadStore完成的,它设计为预先下载所有数据而不是在服务器上进行过滤。
Rather, you should use QueryReadStore, JsonReadStore, etc.
相反,您应该使用QueryReadStore,JsonReadStore等。
#1
1
If I understand you correctly, you want the client to load different set of data from the server based on some general condition defined elsewhere.
如果我理解正确,您希望客户端根据其他地方定义的一般条件从服务器加载不同的数据集。
Basically there is no need to have a <div>
pre-defined. You can also create the 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
#2
0
Typically this isn't done with ItemFileReadStore, which is designed to download all the data up front rather than filtering on the server.
通常,这不是使用ItemFileReadStore完成的,它设计为预先下载所有数据而不是在服务器上进行过滤。
Rather, you should use QueryReadStore, JsonReadStore, etc.
相反,您应该使用QueryReadStore,JsonReadStore等。