4
votes

I have a sencha fiddle for that can be used to reproduce the issue I am seeing here:

https://fiddle.sencha.com/#fiddle/s2e

The issue I am seeing is that if I manually change the filters on my 'Name' column by clicking on Bart, Marge and Homer and then try and sort the items the filter I added in my columns stanza ...

columns: [
    { 
        text      : 'Name',  
        dataIndex : 'name',
        filter   : { type: 'list', value : 'Lisa'}
    },

... overrides the selections I made manually through the UI. Or in other words, "if I click on Bart, Marge and Homer they appear in the grid panel until I sort the rows. When I sort the rows only Lisa is shown."

Is this a bug or am I doing something wrong? I'd hate to think that this is how it is suppose to work.

2
I'd say it is a bug. You can report it with Sencha.Greendrake
I remember seeing this This was a few versions ago, but have you seen this page?Madness
Seems to be a bug indeed. The strange thing is that the way I filter in my grid the filters are respected by the sorter: fiddle.sencha.com/#fiddle/qr6Tarabass
Yeah, it looks strange. If init value does not matter for you just remove value property here: filter: {type: 'list'} and it will work as expected.afschr

2 Answers

1
votes

The column is excluding values that do not match value: 'Lisa' As @afschr said above - removing the value, param will have this functioning.

filter   : { type: 'list'}
0
votes

This is probably a bug. Of course you can change your filter as Akin said. But there is also a workaround if you don't want to change that filter for some reasons. You can stop the sort event after sorting is done so the filter does not reset to default filter which you have set ( filter: { type: 'list', value : 'Lisa'} ).

For that you need to change your Master grid panel in view folder and add a "sortchange" listener to it like below:

Ext.define('MVC.view.Master', {
    extend : 'Ext.grid.Panel',
    xtype  : 'mvc-MasterView',

    title : 'Master Panel',

    store : 'People',
    plugins: 'gridfilters',
    selModel: {
        cellSelect: false,
        type: 'spreadsheet'
    },

    // The code you should add.
    listeners: {
        sortChange: function() {
            this.stopEvent()
        }
    },
    // End of code addition


    columns: [
        { 
            text      : 'Name',  
            dataIndex : 'name',
            filter   : { type: 'list', value : 'Lisa'}
        },
        { 
            text      : 'Email', 
            dataIndex : 'email', 
            flex      : 1 
        },
        { 
            text      : 'Phone',
            dataIndex : 'phone' 
        }
    ]
});