1
votes

I have using the Features - Filters for gridpanel, using local set to true like so

            ftype: 'filters',
            local: true     

Applying the filter and trying in the textfield automatically enabled the Filter checkbox and the grid is filtered.

Unchecking the checkbox next to filter doesn't remove the filter, the checkbox disappears BUT the grid is still showing filtered records.

If I deleting everything in the textfield then all records are shown.

Edit

Here is an example of the columns, store and model. I have only included a example of the company field, model and store items... The store does work as the grid is being populated and the filter works the first time but then i can't remove the filter.

 var columns = [{
            header: 'Company',
            minWidth: 200,
            dataIndex: 'company',
            stateId: 'company-stateid',
            draggable: false,
            flex: 10,
            sortable: true,
            doSort: oMe.performSort,
            filter:
            {
                type: 'string'
            }

Ext.define('APEX.model.CompanyModel', {
    extend: 'Ext.data.Model',
    fields: [
        {name:'company', sortType:Ext.data.SortTypes.asUCString},

Ext.define('APEX.store.Company', {
    extend: 'Ext.data.Store',
    model: 'APEX.model.CompanyModel',

Ext.apply(me, {
            store: mainStore,
            columns: columns,
            selModel: {
                selType: 'rowmodel'
            },
1
Are you un-checking the box by hand, or programmatically?Michael Watson
Manually, default, nothing changed. using extjs 4.2.Martin
I can't replicate it, at least not with that information. On a simple grid, with the filter feature enable in a textfield, removing the checkbox absolutely removes the filter for me. There issue must exist in the configuration of the store, the column, or the grid. Perhaps more code could help.Michael Watson
Yes no problems. Let me update the story...Martin
Updated, I think I seem to be doing everything correctly.Martin

1 Answers

0
votes

I have a problem like yours before, I solved that using this configuration :

//This is my model, you can use type if your field not a string...
Ext.define('EKOJS.model.m_mst_pemohon', {
    extend: 'Ext.data.Model',
    alias       : 'widget.mst_pemohonModel',
    fields      : [{name: 'id_pemohon',type:'int'},'NIP','Nama_Pemohon','Telp','Email'],
    idProperty  : 'id_pemohon'  
});

//this is my column in the grid
this.columns = [
{
    header: 'id_pemohon',filterable:true,
    dataIndex: 'id_pemohon',hidden:true
},{
    header: 'NIP',filterable:true,
    dataIndex: 'NIP'
},{
    header: 'Nama_Pemohon',filterable:true,
    dataIndex: 'Nama_Pemohon'
},{
    header: 'Telp',filterable:true,
    dataIndex: 'Telp'
},{
    header: 'Email',filterable:true,
    dataIndex: 'Email'
}];

// This is for grid filtering feature
this.features = [{
        ftype: 'filters',
        autoReload: true,
        encode: false,
        local: true
    }
];

In case your problem, you can change your config to this, don't forget to adjust your model too :

var feature = [{
        ftype: 'filters',
        autoReload: true,
        encode: false,
        local: true
    }
];

var columns = [{
    header: 'Company',
    minWidth: 200,
    dataIndex: 'company',
    stateId: 'company-stateid',
    draggable: false,
    flex: 10,
    sortable: true,
    doSort: oMe.performSort,
    filterable:true

Ext.define('APEX.model.CompanyModel', {
    extend: 'Ext.data.Model',
    fields: [
        {name:'company', sortType:Ext.data.SortTypes.asUCString},

Ext.define('APEX.store.Company', {
    extend: 'Ext.data.Store',
    model: 'APEX.model.CompanyModel',

Ext.apply(me, {
            store: mainStore,
            columns: columns,
            feature: feature,
            selModel: {
                selType: 'rowmodel'
            },

Hope this help you too.. :D