-
20 Jul 2012 4:17 AM #1
how to Filter column of extjs grid with starting Letter.
how to Filter column of extjs grid with starting Letter.
Hi,
I am new to extjs, I have a column in my grid with name "status" .. I have 2 values 'done' and 'undone' but when i search with 'U' in the text field of filter it is giving the Grid rows which have 'undone' value... But when I type 'D' in the Filter's text field it is Giving both 'done' and 'undone' rows..
The thing is it is Filtering based on the Letter match... U letter is present for only 'undone rows so it is giving undone rows only.. D letter is present for both Done and undone rows so it is giving both rows..
my requirement is to filter with Starting letter so it should display only done rows when i type D..please help
thanks in advance.
-
20 Jul 2012 4:46 AM #2
Can you please post some of your relevant code. I usually use:
Code:my_grid_store.filter('my_column_dataIndex', value_to_search, false);
-
22 Jul 2012 9:29 PM #3
but where to write the above code...?
My code goes like this..
//Filter
var filters = {
ftype: 'filters',
autoReload: false,
local: true,
stateful: false,
model:'MyModel',
filters:[{
dataIndex: 'col1',
type:'string'
}, {
dataIndex: 'col2',
type:'string'
}, {
dataIndex: 'col3',
type:'string'
}]
};
//model
Ext.define('MyModel', {
extend: 'Ext.data.Model',
fields: [{
name: 'col1'
}, {
name: 'col2'
}, {
name: 'col3'
}]
});
My_grid_store = Ext.create('Ext.data.ArrayStore',{
model: 'MyModel'
});
-
22 Jul 2012 11:12 PM #4
Hi,
you can try following code:
Code:Ext.create('Ext.data.Store', { storeId:'simpsonsStore', fields:['name', 'email', 'phone'], data:{'items':[ { 'status': 'Done', "email":"lisa@simpsons.com", "phone":"555-111-1224" }, { 'status': 'Undone', "email":"bart@simpsons.com", "phone":"555-222-1234" }, { 'status': 'Done', "email":"home@simpsons.com", "phone":"555-222-1244" }, { 'status': 'Undone', "email":"marge@simpsons.com", "phone":"555-222-1254" } ]}, proxy: { type: 'memory', reader: { type: 'json', root: 'items' } } }); var grid=Ext.create('Ext.grid.Panel', { title: 'Simpsons', store: Ext.data.StoreManager.lookup('simpsonsStore'), tbar:[{ xtype:'textfield' , enableKeyEvents:true , listeners:{ keyup:{ fn:function(textfield){ this.ownerCt.ownerCt.store.filterBy(function(record){ var name = record.data.name.toLowerCase(); if(name.indexOf(textfield.getValue().toLowerCase()) == 0){ return true; } else{ return false; } }); } } } }], columns: [ { header: 'Status', dataIndex: 'status' }, { header: 'Email', dataIndex: 'email', flex: 1 }, { header: 'Phone', dataIndex: 'phone' } ], height: 200, width: 400, renderTo: Ext.getBody() });sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
28 Mar 2013 1:17 AM #5
filter all columns
filter all columns
I am accessing my grid but inside the function how can i check the value present in all the columns instead of just checking with 'ipAddress'
I have multiple columns in my grid like MAC address, hostname etc.Code:this.getClientStatsGrid().store.filterBy(function(record){ console.log(record); var ip = record.data.ipAddress; if(ip.indexOf(value.toLowerCase()) == 0){ return true; } else{ return false; } })
I want to perform search based on match with any column


Reply With Quote