开发者

Extjs Combobox Autocomplete

I am using Extjs 4 ComboBox with remote mode. but when i typed any character data is not filtered. and even focus is changed only for first 12 value.

Extjs Combobox Autocomplete

I am new to Extjs 4. Please help me how to do this.

my code is:

    Ext.define('MyGroup.combo', {
           extend: 'Ext.form.ComboBox',

           alias: 'widget.mycombo',
        emptyText:'select keyword',
        store: keywordStore,
        valueField:'name',
           displayField:'name',
           mode: 'remote',
           autoSelect: false,
           selectOnFocus:true,
           //shadow:true,
           //forceSelection: false,
           //triggerAction: 'all',
           hideTrigger:true,
           //multiSelect:true,
           typeAhead:true,
        minChars:1
       });

       Ext.define('keywordModel', {
           extend: 'Ext.data.Model',
           proxy: {
               type: 'ajax',
               url : '/keywordServlet',
               method:'POST',
               reader: {
                   type: 'json',
   开发者_开发问答                root: 'rows'
                   //,totalProperty: 'totalCount'
               }
           },

           fields: [
               {name: 'name', mapping: 'name'}
           ]
       });

          var keywordStore = Ext.create('Ext.data.Store', {
             // pageSize: 10,
              model: 'keywordModel'
          });


As per my knowledge i think this will be helpful for you:

Ext.define('MyGroup.combo', {
           extend: 'Ext.form.ComboBox',
           alias: 'widget.mycombo',
    initComponent: function() {
        this.callParent([arguments]);
    }
});

var keywordStore = Ext.create('Ext.data.SimpleStore',{
    fields: ['id', 'name'],
    data: [[1, 'mr'],[2, 'mr(yes)'],[3, 'mr(no)'], [4, 'example'], [5, 'example(yes)'],[6,'example(no)'],[7,'sample'],[8,'sample(yes)'],[9,'sample(no)'],[10,'mrs'],[11,'mrs(yes)'],[12,'mrs(no)']]
});

Ext.widget('mycombo',{
    xtype : 'combo',
        emptyText:'select keyword',
        store: keywordStore,
        valueField:'name',
           displayField:'name',
           mode: 'remote',
           autoSelect: false,
           selectOnFocus:true,
           //shadow:true,
           //forceSelection: false,
           //triggerAction: 'all',
           hideTrigger:true,
           //multiSelect:true,
           typeAhead:true,
        minChars:1,
    renderTo :document.body
       });

And one more thing is no one is trying to answer each and every question,but every one is trying to help some body like us:-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜