Extjs4.2 filter on one column and user can use separator to match different rows

I have to filter on one column, and user can use separator to match different rows, like this: (As I couldn't post images, I have to describle the menuitme for my column)

Sort Ascending
Sort Descending
Filters =>  Jim|Tom

User could enter "Jim|Tom" in the Textbox to filter on the Grid.

But Generally, it seems not supported by Extjs 4.2. I found that apply multiple values for one property does not work like above.

Here is my column definition for this column 'Owner':

{   
    text:'Owner',
    width:50,
    dataIndex:'owner',
    sortable:true,
    filter:{
    type:'string',
    }
},

How could I solver this problem?

Thanks.

Alex

Answers


You would need to override string filter, something like (untested):

Ext.define('MyOverride', {
   override: 'Ext.ux.grid.filter.StringFilter',

    validateRecord : function (record) {
        var val = record.get(this.dataIndex);

        if(typeof val != 'string') {
            return (this.getValue().length === 0);
        }
        val = val.toLowerCase();
        var parts = this.getValue().toLowerCase().split('|'),
            found = false;

        Ext.Array.forEach(parts, function(part) {
            if (val.indexOf(part) > -1) {
                found = true;
            }
        });

        return found;
    }
});

Need Your Help

How to modify a token in a text file?

php phing

I have 3 config files with a token like "[DBPASSWORD]" that I'd like to modify from my "build" task wiht Phing. I didn't find a task that performs what I need and before writing my own task for thi...

how to subquery in queryset in django?

python django

how can i have a subquery in django's queryset? for example if i have:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.