6

I have a combobox like http://jsfiddle.net/8jnRR/

enter image description here
Here is my store

var stored = new Ext.data.SimpleStore({
      fields: [ "value", "text" ],
      data: [
        [ 0, "Online0" ],
        [ 1, "Online1" ],
        [ 2, "Online2" ]
        ,[ 100, "Hide" ] // how to hide this item
      ]
    });


I want to hide a item has value is 100 above. How to do that, thanks so much

DeLe
  • 2,442
  • 19
  • 88
  • 133

1 Answers1

6

Take a look at this modified fiddle http://jsfiddle.net/jdflores/8jnRR/1/ It uses the store's filters config. I'm including a function that determines if the record.data.value is less than 100:

filters: [function(record, id){
    return (record.data.value < 100);
}],
  • see here http://jsfiddle.net/98xEq/ i want to get hide item :( alert(stored.find('value', 100)); // 100 no exist – DeLe Jul 23 '13 at 06:15
  • Well, store.find() will not work as that item is no longer part of store. If you need access to that item, you need to call store.clearFilter() – player Jul 23 '13 at 06:21
  • 1
    Not sure, what you are trying to achieve. Can you explain your problem a bit more. You can always reapply the filter after accessing the item – player Jul 23 '13 at 06:27
  • 4
    queryBy method is not affected by filter, so you can find records even if they are filtered out. Take a look: http://jsfiddle.net/jdflores/98xEq/1/ – Juan Daniel Flores Jul 23 '13 at 06:28