1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    4
    Vote Rating
    0
    Sarika is on a distinguished road

      0  

    Default 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.

  2. #2
    Sencha User
    Join Date
    Dec 2011
    Posts
    20
    Vote Rating
    2
    jennifer123 is on a distinguished road

      0  

    Default


    Can you please post some of your relevant code. I usually use:

    Code:
    my_grid_store.filter('my_column_dataIndex', value_to_search, false);

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    4
    Vote Rating
    0
    Sarika is on a distinguished road

      0  

    Default


    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'
    });

  4. #4
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    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.

  5. #5
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Bangalore
    Posts
    79
    Vote Rating
    1
    rupamkhaitan is on a distinguished road

      0  

    Default 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'

    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 have multiple columns in my grid like MAC address, hostname etc.
    I want to perform search based on match with any column

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi