-
20 Sep 2011 5:41 AM #11
I am sorry
I am sorry
I just posted in Ext forum, I dint notice the forum version.
Yes I am using 3.2.1.
Can you help me to fix this issue in 3.21 version ?
thanks in advance
-
20 Sep 2011 5:43 AM #12Sencha - Community Support Team
- Join Date
- Nov 2007
- Location
- Helsingborg, Sweden
- Posts
- 2,454
- Vote Rating
- 48
Your code works fine for me in firebug, getCmp returns the expected grid component.
-
20 Sep 2011 5:49 AM #13
why its not working for me?
why its not working for me?
Can you check your EXT js version ? Mine is 3.2.1
Its throws error. I got stuck in this issue for last 2 days.
-
20 Sep 2011 5:50 AM #14
-
20 Sep 2011 5:52 AM #15
whats solution for me?
whats solution for me?
How can I fix?
-
20 Sep 2011 5:53 AM #16Sencha - Community Support Team
- Join Date
- Nov 2007
- Location
- Helsingborg, Sweden
- Posts
- 2,454
- Vote Rating
- 48
What line throws the error? How have you debugged this?
-
20 Sep 2011 5:57 AM #17
firbug + firefox
firbug + firefox
throws error on the line which highligted in red color
i.e. var grid=Ext.getCmp("My_Grid_Panel").getView();
-
20 Sep 2011 6:03 AM #18Sencha - Community Support Team
- Join Date
- Nov 2007
- Location
- Helsingborg, Sweden
- Posts
- 2,454
- Vote Rating
- 48
You're doing it backwards. I'm guessing getState gets called as soon as you create the toolbar. At this time the grid hasn't yet been registered with the component manager (i.e. Ext.getCmp is called too early).
You should clean your code up and make sure you do things in the right order. A quick hack that might get this working is to assign a local variable to your grid.
Code:MyPanel = Ext.extend(Ext.grid.GridPanel, { pageSize: 30, dataLoaded: false, stateful: true, stateId: "my_state_id_grid", initComponent: function() { var grid = this; Ext.QuickTips.init(); Ext.apply(this, { store: { xtype: 'jsonstore', totalProperty: 'total', proxy: new Ext.data.HttpProxy({ method: 'GET', disableCaching: false, url: '/xx/xx/xx' }), root: 'fields', fields: ['xxx'] }, colModel: new Ext.grid.ColumnModel([ { header: 'xxx', dataIndex: 'xxx', width: 100, sortable: true, hidden: true } ]), selModel: new Ext.grid.RowSelectionModel({ singleSelect: true }), iconCls: 'icon-grid', loadMask: true, autoScroll: true, viewConfig: { forceFit: true } }); this.plugins = [new Sleuth.filter.GridFilters({ local: false, stateful: true, stateId: 'state_id_grid_filter', encode: true, filters: [ {type: 'string', dataIndex: 'xxx'}, ], })]; this.bbar = new Ext.PagingToolbar({ pageSize: this.pageSize, stateId: 'my_id_pagin', stateful: true, store: this.store, displayInfo: true, plugins: this.plugins, xtype: 'paging', stateEvents: ["change"], getState: function() {var state = Ext.state.Manager.getProvider(); state.set('startStore',this.store.lastOptions.params.start); state.set('active_field', grid.filters.keyTracker[0]); return {pageSize: this.pageSize}; } }); MyPanel.superclass.initComponent.apply(this, arguments); this.on({afterlayout: {single: true, fn:function() { this.bottomToolbar.bindStore(this.store); var state = Ext.state.Manager.getProvider(); var start = state.get('startStore',0) this.getStore().load({params: {start: start, limit: this.pageSize}}); } }}); } }); var MyNewPanel = new MyPanel({id:'My_Grid_Panel',pageSize: 40});
-
20 Sep 2011 7:31 AM #19
another error
another error
If I use local variable then I am getting error as,
grid.grid is undefined
[IMG]chrome://firebug/content/blank.gif[/IMG] state.set('active_field',grid.grid.filters.keyTracker[0]);
Can you tell me how my script got worked for you ? Did you made any changes?
-
20 Sep 2011 7:40 AM #20
In my grid i have a button to clear the filter, in which I tired to access the grid the same procedure
[CODE]
this.bbar = new Ext.PagingToolbar({
pageSize: this.pageSize,
stateId: 'my_id_pagin',
stateful: true,
store: this.store,
displayInfo: true,
plugins: this.plugins,
xtype: 'paging',
items:[
'-', {
enableToggle:false,
text: 'Clear Filter',
handler: function(btn, pressed){
var grid=Ext.getCmp("ext-comp-1001").getView();
grid.grid.filters.clearFilters();
}
},....
[CODE]
But throws same error. I hope this time the grid would have registered with component manager.


Reply With Quote