Oliver Watkins
Oliver Watkins

Reputation: 13509

ExtJS FiltersFeature not working anymore

I don't understand :(

It was working fine before. I had filters on all my columns in my ExtJS Grid. Now it just throws an error. The first time I click on the header-arrow I get the following stack:

Uncaught TypeError: object is not a function FiltersFeature.js?_dc=1403012616973:285
Ext.define.initializeFilters FiltersFeature.js?_dc=1403012616973:285
Ext.define.createFilters FiltersFeature.js?_dc=1403012616973:265
Ext.define.onMenuCreate FiltersFeature.js?_dc=1403012616973:300
fire ext-all-debug.js:9815
continueFireEvent ext-all-debug.js:11207
fireEventArgs ext-all-debug.js:11185
prototype.fireEventArgs ext-all-debug.js:41542
fireEvent ext-all-debug.js:11171
Ext.define.getMenu ext-all-debug.js:109192
Ext.define.showMenuBy ext-all-debug.js:109115
Ext.define.onHeaderTriggerClick ext-all-debug.js:109110
Ext.define.onTitleElClick ext-all-debug.js:109894
(anonymous function) VM2875:6
wrap

I am defining my columns in a method like so :

var createColumns = function () {

    var columns = [{
        dataIndex: 'id',
        text: 'ID',
        renderer: function(val) {
            return '<b>' + val+ '</b>';
        },
        width: 80
        ,
        filter: {
            type: 'int'
        }
    }, {

        dataIndex: 'releaseId',
        text: 'Release',
        filter: {
            type: 'number'
        }
    }, {
        dataIndex: 'requires',
        text: 'Requires ',
        filter: {
            type: 'string'
        }
    }, {
        dataIndex: 'creation',
        text: 'Status Changed?',
        filter: {
            type: 'date'
        }
    }, {
        dataIndex: 'creator',
        text: 'Creator',
        filter: {
            type: 'string'
        }
    }];
    return columns;
};

Not sure why this error is suddenly happening now.

Upvotes: 0

Views: 280

Answers (2)

Oliver Watkins
Oliver Watkins

Reputation: 13509

OK I know what the problem is. I am using type 'number' in my filter configuration, when I should be using numeric or int.

dataIndex: 'releaseId',
text: 'Release',
filter: {
    type: 'number'
}

Instead it should be

dataIndex: 'releaseId',
text: 'Release',
filter: {
    type: 'int'
}

Now I don't get the problem anymore. It was just a typo.

Upvotes: 0

Dev
Dev

Reputation: 3932

Try this way:

initComponent : function() {
    var filters = {
        ftype : 'filters',
        encode : false, // json encode the filter query
        local : true,
        autoReload : false
    };
    var numberFilters = {
    minValue: 0
    }
        ............
   columns : [ {
                 text : 'Id'
                 filter: { 
                    type: 'numeric',
                    fields: {
                        eq: numberFilters
                    }
                 },
              }
             ....
            ]

Upvotes: 1

Related Questions