extjs - How to achieve Live Search/Filtering on Multiple Fields in the Grid using Ext.Js? -


i have done live search on grid. searching based on column mentioned filter code. need filter grid records based on multiple column search. in below code searches name column because mentioned name filed in filter code. not getting how achieve multiple column value search? can 1 tell me how achieve? great appreciated. thank .

grid code here:

{                 xtype: 'gridpanel',                 flex: 2,                 hidden: false,                 store: store,                 loadmask: true,                 id: 'grid',                 columns: [                     {id:'id',header: 'id', width: 100, sortable: true, dataindex: 'id'},                     {header: 'name', width: 150, dataindex: 'name'},                     {header: 'position', width: 150, dataindex: 'position'},                     {header: 'ambition', width: 250, dataindex: 'ambition'}                                     ],                 striperows: true,                                title:'straw hats crew',               }, 

livesearch text change here:

ontextfieldchange: function(field, newvalue, oldvalue, options){         var grid = ext.getcmp('grid');         if(newvalue==''){             grid.store.clearfilter();         }         else {             grid.store.clearfilter();             grid.store.load().filter([                 {id: 'name', property: "name", value: newvalue, anymatch: true}             ]);                     }     }, 

something should work. can specify arbitrary filter function can check fields in model.

ontextfieldchange: function(field, newvalue, oldvalue, options){     var grid = ext.getcmp('grid');     grid.store.clearfilter();      if (newvalue) {         var matcher = new regexp(ext.string.escaperegex(newvalue), "i");         grid.store.filter({             filterfn: function(record) {                 return matcher.test(record.get('id')) ||                     matcher.test(record.get('name')) ||                     matcher.test(record.get('position')) ||                     matcher.test(record.get('ambition'));             }         });     } } 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -