煎茶触摸中的搜索字段



我正在尝试在 sencha touch 1.1 中向我的表单添加一个搜索字段,但在浏览了 sencha touch 提供的示例后,我找不到为搜索字段提供动态存储的方法。我有一个可以动态获取数据的商店。商店包含地点列表,当用户输入地点的第一个字母时,应向他提供从该字母开始的地点列表这是我使用的代码。

var searchField = new Ext.form.Search({
        name : 'search',
        placeHolder: 'Search',
        useClearIcon: true,
        data:siteStore,
        autoComplete:true,

    });

inputDataForm = Ext.extend(Ext.Panel, {
    scroll: 'vertical',
    autoDestroy: true,
    layout: 'fit',
    id:'inputForm',

   initComponent: function() {

    this.items = [{
                    xtype: 'form',
                    cls: 'formClass',
                    id:'inputImageForm',                        
                    bodyPadding: '0',
                    scroll: 'vertical',

                    items: [searchField],
                  }];       
    inputDataForm.superclass.initComponent.call(this);  
   }, // End fo initComponent   
});

有人可以帮忙吗?谢谢

这是我

的代码。它工作正常,我已经将搜索字段停靠在一个面板中。
你可以使用它,我相信它有效。

,   dockedItems: [{
                xtype:'searchfield'
            ,   name: "searchfield"
            ,   placeHolder: 'Search Patient'
            ,   id: 'searchPat'
            ,   listeners: {
                    keyup: function(me,e){
                        var searchData = me.getValue();
                        Ext.Ajax.request({
                            url:'your data url'
                        ,   params:{
                                filter: searchData
                            }
                        ,   scope: this
                        ,   success: function(res){
                                var rec = Ext.decode(res.responseText);
                                var def = typeof (rec.success);
                                if(def != "undefined" ){
                                    this.store.removeAll();
                                    this.store.loadData(rec.patients);
                                }
                            }
                        ,   failure:function(res){
                                console.log(res);
                            }   
                        })
                    }
                ,   scope: this
                }

最新更新