【问题标题】:dojo Autocomplete道场自动完成
【发布时间】:2011-10-31 17:35:57
【问题描述】:

我可以使用dijit.form.FilteringSelect 来显示下拉框。但它会立即从商店dojo.data.ItemFileReadStore 请求我不想要的所有数据。我希望它使用文本框的当前值查询商店并显示自动完成器选项。

【问题讨论】:

    标签: javascript autocomplete dojo


    【解决方案1】:

    上面的一个更完整的例子,但等于有效。但就我而言,我使用QueryReadStore

     this.store = new dojox.data.QueryReadStore({
                    url: 'url',
                    sortFields :  [{attribute: 'attribute', descending: true}],
                    requestMethod : "get"}
                );
    
    callSuggest : function(){
            var fetch = {
                    query: {attribute: "*"},
                    queryOptions: {
                        ignoreCase: true,
                        deep: true
                    },
                    serverQuery: this.searchParam,
                    onComplete: dojo.hitch(this, function(result, dataObject){
                        //do something
                    }),
                    onError: function(errText){
                        console.error('error');
                    }
                };
            this.store.fetch(fetch);
        },
    

    【讨论】:

      【解决方案2】:

      我假设你必须执行类似的操作,

      itemStore .fetch({ query: { name: "pepper", aisle: "Spices" },
      queryOptions: { ignoreCase: true }, onComplete: ... });

      请查看此链接以获取完整列表和详细信息。 http://dojotoolkit.org/reference-guide/quickstart/data/usingdatastores/filteringitems.html

      【讨论】:

      • 否 那仍然需要从商店下载 While 数据。它只是商店上的自定义查询。从商店接收部分数据。
      猜你喜欢
      • 1970-01-01
      • 2020-01-17
      • 1970-01-01
      • 2015-09-20
      • 1970-01-01
      • 2013-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多