Results 1 to 3 of 3

Thread: Cannot work filter by other column only at 1st time

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User mashiki's Avatar
    Join Date
    Oct 2007
    Location
    Japan
    Posts
    139

    Default Cannot work filter by other column only at 1st time

    REQUIRED INFORMATION


    Ext version tested:
    • Ext 4.2.1 rev 883
    • Ext 4.1.1 rev ?

    Browser versions tested against:
    • Chrome 27.0.1453.110 m
    • IE9.0.8112.16421
    • FF21.0 (firebug 1.11.4 installed)

    DOCTYPE tested against:
    • DOCTYPE html

    Description:
    • Cannot work filter by other column only at 1st time

    Steps to reproduce the problem:
    • 1 Open http://fiddle.jshell.net/mashiki/LB72a/79/show/
    • 2 Choose one of 'subtype' cell.
    • 3 Expand the combobox of the cell.
    • 4 combobox shows all of 'subtype'. -> problem
    • 5 Chose other 'subtype' cell.
    • 6 Expand the combobox of the cell.
    • 7 Now and after try, we have correct filtered 'subtype' combobox.

    The result that was expected:

    Test Case:

    HELPFUL INFORMATION

    See this URL for live test case: http://fiddle.jshell.net/mashiki/LB72a/79/show/


    Debugging already done:

    Possible fix:
    • not provided

    Additional CSS used:
    • only default ext-all.css

    Operating System:
    • Windows7 Pro
    • WinVista Home
    *EDIT BY SLEMMON
    Issue with filterBy() not adding the filter to the store's filters array correctly. Suggesting filter(new Ext.util.Filter({ filterFn: function(){} })) for the time being.

    Small inline test case:
    Code:
    var data = Ext.create('Ext.data.Store', {
        fields: ['id', 'type', 'subtype', 'comment'],
        data: (function(len) {
            for (var i=0,ret=[]; i<len; ++i) {
                ret.push({
                    id:i,
                    type: i%3,
                    subtype: -1,
                    comment: "Record-"+i+"\ncomment"+i
                });
            }
            return ret;
        })(10)
    });
    
    
    var subtypes = Ext.create('Ext.data.Store', {
        fields: ['id', 'type', 'name'],
        data:[
            {id:-1, type:-1, name:'NOT SELECTED'},
            {id:0, type:0, name:'post_A'},
            {id:1, type:0, name:'post_B'},
            {id:3, type:1, name:'rss_A'},
            {id:4, type:1, name:'rss_B'},
            {id:5, type:1, name:'rss_C'},
            {id:6, type:1, name:'rss_D'},
            {id:7, type:2, name:'tabs_A'}
       ]
    });
    
    
    Ext.widget({
        xtype:'grid',
        renderTo: document.body,
        height: 400,
        width: 400,
        plugins: {
            ptype:'cellediting',
            clicksToEdit:1,
            listeners: {
                beforeedit: function (editor, e) {
                    var column = e.column,
                        editorStore = column.getEditor().getStore(),
                        typeField = column.typeField;
    
    
                    editorStore.clearFilter(true);
                    (editorStore.filterBy(function(rec) {
                        return rec.get(typeField) == e.record.get(typeField);
                    });
                    /*editorStore.filter(new Ext.util.Filter({
                        filterFn: function (rec) {
                            return rec.get(typeField) == e.record.get(typeField);  
                        }
                    }));*/
                }
            }
        },
        store     : data,
        columns   : [{
            text:'subtype',
            dataIndex:'subtype',
            typeField: 'type',
            width:100,
            editor: {
                xtype:'combobox',
                valueField:'id',
                displayField:'name',
                editable: false,
                store: subtypes,
                queryMode: 'local'
            }
        }]
    });
    Last edited by slemmon; 10 Jun 2013 at 3:27 PM. Reason: Additional error notes

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

    In the meantime use the following:
    Code:
    col.field.store.clearFilter(true);
    /*col.field.store.filterBy(function(rec) {
    	return rec.get(col.typeField)==grid_rec.get(col.typeField);
    });*/
    col.field.store.filter(new Ext.util.Filter({
        filterFn: function (rec) {
            return rec.get(col.typeField) == grid_rec.get(col.typeField);
        }
    }));
    Also, don't forget to use queryMode: 'local' on your locally loaded combobox.

  3. #3
    Sencha User mashiki's Avatar
    Join Date
    Oct 2007
    Location
    Japan
    Posts
    139

    Default

    Hi! slemmon,

    Thank you to simplify my problem code,
    and your temporary code runs perfect at my project.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •