Mike
Mike

Reputation: 109

Extjs grid filter using store.filter

I am using this to output a query from a database which outputs my data as I expect.

We are now wanting to filter that data by passing the the 'color' column if we want.

<script type="text/javascript">
Ext.onReady(function(){

        var events_ds = new Ext.data.JsonStore({
                autoLoad: true,
                autoDestroy: true,
                url: '<% $base %>json/events/WWN.json',
                storeId: 'events_ds',
                idProperty: 'id',
                fields: [ 'id', 'precedence', 'affectedWWN', 'eventType', 'color', 'CollectTime' ]
        });

        var event_grid = new Ext.grid.GridPanel({
                title: 'Events',
                ds: events_ds,
                height: 300,
                columns: [
                         { 
                          header: "ID", 
                          dataIndex: 'id',
                         },
                         {
                          header: "Priority",
                          dataIndex: 'precedence',
                          sortable: true
                         }, 
                         {
                          header: "affectedWWN",
                          dataIndex: 'affectedWWN',
                          width:150,
                          sortable: true
                         },
                         {
                          header: "eventType",
                          dataIndex: 'eventType',
                          width:300,
                          sortable: true
                         },
                         {
                          header: "color",
                          dataIndex: 'color',
                          sortable: true
                         },
                         {
                          header: "CollectTime",
                          dataIndex: 'CollectTime',
                          width:150,
                          sortable: true
                         }]
        });

        var main_panel = new Ext.Panel({
                autoScroll: true,
                renderTo: 'main_panel',
                items: [event_grid]
        });

});

</script>

I am new at this and what I am seeing is to use something similar to this:

store.filter("color", "yellow");

but the filtering doesn't work like I am expecting.

What am I missing?

Upvotes: 0

Views: 960

Answers (1)

yinwz
yinwz

Reputation: 11

var event_grid = new Ext.grid.GridPanel({ 
                title: 'Events', 
                //ds: events_ds, ???
                store: events_ds,

Upvotes: 1

Related Questions