-
22 Feb 2013 6:48 AM #1
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 :
My grid with the filter in red :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' } );
If I use array options, all is good.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'] // ] } })]});Last edited by lpastor; 25 Feb 2013 at 4:23 AM. Reason: SOLVED
-
24 Feb 2013 5:34 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
Is the store loaded?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
25 Feb 2013 1:59 AM #3
Hello,
Yes it is :
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...Code:store_categorie.load({ callback: function(records, operation, success) { store.load(); }, scope: this });
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
-
25 Feb 2013 4:22 AM #4
I find a solution in the forum :
Do an override of the list menu:
and use labelField: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); } }; }() });
Code:filter: {type: 'list', labelField: 'nom_categorie', dataIndex: 'fk_categorie_personne', store: store_categorie}


Reply With Quote