Manuel
Manuel

Reputation: 9522

Extjs 4 remote filter store smaller (<) bigger (>) than

Is it possible to remote filter smaller than and bigger than? I know how to handle this in php and mysql but I don't know how to set such a filter in a extjs 4 store.

Upvotes: 1

Views: 1180

Answers (2)

Aladin Lee
Aladin Lee

Reputation: 51

I usually override the Ext.data.proxy.Server, like this:

// ext store remote filter missing operator fix
Ext.override(Ext.data.proxy.Server, {encodeFilters: function(filters) {
    var min = [],
        length = filters.length,
        i = 0;

    for (; i < length; i++) {
        if(filters[i].property && filters[i].value){
            min[i] = {
                operator: filters[i].operator,
                property: filters[i].property,
                value   : filters[i].value
            };
        }
    }
    return this.applyEncoding(min);
}});

Upvotes: 0

sra
sra

Reputation: 23983

Out of the box with 4.1, no.

You will need to overwrite the responsible provider proxy for that cause currently only property-value pairs get submitted (responsible function). The other point is that the Ext.util.Filter don't support any comparator for remotesort at all. So you have to implement your own and ensure that the store don't support local filtering (cause that won't work).

As a workarround you can commit the smaller/bigger along with the value as encoded string and substract the it then on the serverside. This would just cause a local filter to get no results.

Upvotes: 1

Related Questions