1. #1
    Ext JS Premium Member
    Join Date
    Nov 2008
    Location
    Warsaw area, Poland
    Posts
    64
    Vote Rating
    1
    nightwatch is on a distinguished road

      0  

    Default Answered: ComboBox autocomplete with local mode - substring search instead of prefix match

    Answered: ComboBox autocomplete with local mode - substring search instead of prefix match


    Hi, I have a combobox configured for autocompletion in queryMode: "local":

    Code:
    editor: {xtype: 'combobox', store: dataSrcSt, valueField: 'Id', displayField: 'Description', allowBlank: false, queryMode: 'local', typeAhead: true, minChars: 2}
    And the autocomplete seems to work - it matches a correct entry if a prefix of the display value is entered. But what should I do to filter the entries by matching a substring anywhere in the display value ( 'displayValue like *typedText*', not 'like typedText*')

    ExtJS 4.1

    Thanks
    RG

  2. You can try this:
    PHP Code:
    Ext.onReady(function() {

    var 
    simpleCombo Ext.create('Ext.form.field.ComboBox', {
      
    fieldLabel'Select a single state',
      
    displayField'name',
      
    valueField'abbr',
      
    width320,
      
    labelWidth130,
      
    queryMode'local',
      
    typeAheadtrue,
      
    minChars2,
      
    name'agentDownline',
      
    store: new Ext.data.SimpleStore({
          
    fields: ['abbr''name''slogan'],
          
    data: [
            [
    'VA''Virginia',      'Mother of States'],
            [
    'WA''Washington',    'Green Tree State'],
            [
    'WV''West Virginia''Mountain State'],
            [
    'WI''Wisconsin',     'America\'s Dairyland'], 
            [
    'WY''Wyoming',       'Like No Place on Earth']
          ]
      }),
      
    listeners: {
        
    buffer50,
        
    change: function() {
          var 
    store this.store;
          
    //store.suspendEvents();
          
    store.clearFilter();
          
    //store.resumeEvents();
          
    store.filter({
              
    property'name',
              
    anyMatchtrue,
              
    value   this.getValue()
          });
        }
      }
    });

    Ext.create("Ext.Window", {
        
    itemssimpleCombo
    }).show(); 
    Is that what you are looking for?

  3. #2
    Sencha User
    Join Date
    Oct 2011
    Location
    Ukraine
    Posts
    153
    Answers
    11
    Vote Rating
    6
    Romick is on a distinguished road

      0  

    Default Hii

    Hii


    You can try this:
    PHP Code:
    Ext.onReady(function() {

    var 
    simpleCombo Ext.create('Ext.form.field.ComboBox', {
      
    fieldLabel'Select a single state',
      
    displayField'name',
      
    valueField'abbr',
      
    width320,
      
    labelWidth130,
      
    queryMode'local',
      
    typeAheadtrue,
      
    minChars2,
      
    name'agentDownline',
      
    store: new Ext.data.SimpleStore({
          
    fields: ['abbr''name''slogan'],
          
    data: [
            [
    'VA''Virginia',      'Mother of States'],
            [
    'WA''Washington',    'Green Tree State'],
            [
    'WV''West Virginia''Mountain State'],
            [
    'WI''Wisconsin',     'America\'s Dairyland'], 
            [
    'WY''Wyoming',       'Like No Place on Earth']
          ]
      }),
      
    listeners: {
        
    buffer50,
        
    change: function() {
          var 
    store this.store;
          
    //store.suspendEvents();
          
    store.clearFilter();
          
    //store.resumeEvents();
          
    store.filter({
              
    property'name',
              
    anyMatchtrue,
              
    value   this.getValue()
          });
        }
      }
    });

    Ext.create("Ext.Window", {
        
    itemssimpleCombo
    }).show(); 
    Is that what you are looking for?

  4. #3
    Ext JS Premium Member
    Join Date
    Nov 2008
    Location
    Warsaw area, Poland
    Posts
    64
    Vote Rating
    1
    nightwatch is on a distinguished road

      1  

    Default


    Yes, that's the solution. Thanks!

  5. #4
    Sencha User kitteh's Avatar
    Join Date
    Jul 2013
    Posts
    1
    Vote Rating
    0
    kitteh is on a distinguished road

      0  

    Default THANKS

    THANKS


    Thanks from me too, it helped me alot!!!

  6. #5
    Sencha User jdflores's Avatar
    Join Date
    Aug 2011
    Posts
    18
    Vote Rating
    2
    jdflores is on a distinguished road

      1  

    Default Try enableRegEx

    Try enableRegEx


    The combobox has an extra property as of 4.1.3, it's called 'enableRegEx'. If the mode is local it will do the matching without having to listen for a change in this field.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar