ExtJs: Search / Filter within a ComboBox

后端 未结 8 1330
甜味超标
甜味超标 2021-01-05 15:05

I\'ve the following problem / question in ExtJs 2.3:

I\'d like to do a search within a combobox. I\'ll give you an example:

Ext.comboData.names = [[\         


        
8条回答
  •  粉色の甜心
    2021-01-05 15:46

    ExtJS ComboBox has a keydown event (and keyup, and keypress) that you can use for this purpose.

    ExtJS SimpleStore also has a filter method that should suit your purpose. You can use it like this (to find values that contain an 'a' character):

    store.filter('name', 'a', true, true)
    

    First parameter is the record field, second is the string/regexpt to look for, third parameter means that filter should match any part of field (instead of just the beginning of the value), and the last value determines the case-sensitivity. You can turn it off, of course, if you like.

    All of this applies to ExtJS 2.3.0. Hopefully this will get you started.

提交回复
热议问题