Hybrid View

  1. #1
    Sencha User
    Join Date
    Aug 2009
    Posts
    113
    Vote Rating
    0
    lpastor is on a distinguished road

      0  

    Default Filter menu in a combo grid not populated [SOLVED]

    Filter menu in a combo grid not populated [SOLVED]


    Hello,

    I use Ext 4.1.1.

    I don't understand why my list menu ins't populated?

    bug.png

    Here are my stores :
    Code:
        var store_categorie = Ext.create('LP.store', 
            Ext.define('Categorie', {
                extend: 'Ext.data.Model',
                idProperty:  'id_categorie',
                autoLoad: true,
                remoteFilter: true,
                fields: [
                    {name: 'id_categorie', type: 'int'}, 
                    {name: 'nom_categorie'}
                ]
            }),
            {
                base: 'essai',
                table: 'categorie',
                idk: 'id_categorie'
            }
        );
    
        
        var store = Ext.create('LP.store', 
            Ext.define('Personne', {
                extend: 'Ext.data.Model',
                idProperty:  'id_personne',
                autoLoad: false,
                remoteSort: true,
                remoteFilter: true,
                remoteGroup: false,
                fields: [
                    {name: 'id_personne', type: 'int', useNull: true}, 
                    {name: 'fk_categorie_personne', type: 'int'}, 
                    {name: 'mail_personne'},
                    {name: 'prenom_personne'}, 
                    {name: 'nom_personne'}
                ],
            }),
            {
                base: 'essai',
                table: 'personne',
                idk: 'id_personne'
            }
        );
    My grid with the filter in red :
    Code:
      var Grid = Ext.create('Ext.grid.Panel',{
            iconCls: 'icon-grid',
            title: 'User List',
            flex: 1,
            store: store,
            frame: true,
            collapsible: true,
            multiSelect: true,
            plugins: [Ext.create('Ext.grid.plugin.CellEditing')],
            features: [{ftype: 'filters'}],
            columns: [
                 {
                    text: 'ID',
                    width: 40,
                    sortable: true,
                    dataIndex: 'id_personne'
                },
                {header: "Cat├ęgorie", width: 60, sortable: true, dataIndex: 'fk_categorie_personne', editor: new Ext.form.ComboBox({ 
                    typeAhead: false,
                    editable: false,
                    triggerAction: 'all',
                    //lazyRender: true,
                    queryMode: 'remote',
                    //mode: 'local',
                    store: store_categorie,
                    displayField: 'nom_categorie',
                    valueField: 'id_categorie',
                    filterable: true,
                    lastQuery: '',
                    }),renderer: 
                        function(value) {            
                            var r = store_categorie.getById(value);
                            return r ? r.get('nom_categorie') : '<?>';
                    },
                    filter: {
                        type: 'list',
                        dataIndex: 'fk_categorie_personne',
                        store: store_categorie
                        // options: [
                            // [11, 'extra small'],
                            // [18, 'small'],
                            // [22, 'medium'],
                            // [35, 'large'],
                            // [44, 'extra large']
                        // ]
                    }
                })
    ]
    });
    If I use array options, all is good.
    Last edited by lpastor; 25 Feb 2013 at 4:23 AM. Reason: SOLVED

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is the store loaded?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Aug 2009
    Posts
    113
    Vote Rating
    0
    lpastor is on a distinguished road

      0  

    Default


    Hello,

    Yes it is :

    Code:
        store_categorie.load({
            callback: function(records, operation, success) {
                 store.load();
            },
            scope: this
        });
    I have change the column name of the 'id_categorie' in the database for just 'id', now filter work well, but the filter menu have always a bad display...

    I found with Ext 4.1.3 there is an 'idField', also is there a work around with ext 4.1.1 to have id column name, different than just 'id' ?

    Laurent

  4. #4
    Sencha User
    Join Date
    Aug 2009
    Posts
    113
    Vote Rating
    0
    lpastor is on a distinguished road

      0  

    Default


    I find a solution in the forum :

    Do an override of the list menu:

    Code:
    Ext.override(Ext.ux.grid.menu.ListMenu,{
            show : function () {
                var lastArgs = null;
                return function(){
                    if(!arguments){
                        this.callParent(lastArgs);
                    } else {
                        lastArgs = arguments;
                        if (this.loadOnShow && !this.loaded) {
                            this.store.load();
                        }
                        this.callParent(arguments);
                    }
                };
            }()
        });
    and use labelField:
    Code:
    filter: {
    type: 'list', labelField: 'nom_categorie', dataIndex: 'fk_categorie_personne', store: store_categorie
    }

Thread Participants: 1