hallikpapa
19 Oct 2011, 12:45 PM
In extjs4, I would have a TabPanel with grids in each tab. Depending on which one was selected is how I chose which store to load. In ST, I am using a carousel. I have one defined like this:
Ext.define('Ace.view.LinkSummaryCarousel', {
extend: 'Ext.Carousel',
xtype : 'linkcarousel',
id : 'linkSummaryCarousel',
requires: ['Ace.view.LinkSummaryGrid', 'Ext.Carousel'],
config: {
title: 'Top Pages',
items: [{
xtype : 'linkgrid',
ufq : 'somedata'
},{
xtype : 'linkgrid',
ufq : 'moredata'
}]
}
});
So everything is loading fine, but I want to only load the store on the viewable grid. I am trying to do it like this in the controller:
refs: [
{ ref : 'carousel', selector: '#linkSummaryCarousel' }
],
init: function() {
this.control({
'#linkSummaryCarousel': {
show : this.onLinkGridRender
}
});
onLinkGridRender : function(me, eOpts) {
console.log('grid render');
//only load active item
//var grid = this.getLinkcarousel();
var grid = this.getLinkcarousel().getActiveItem();
var x = grid.items.first();
if (grid) {
grid.getStore().load({params : {ufq : this.ufq}});
}
},
I have attached a screenshot of what is available when I just execute this.getLinkcarousel(). getActiveItem() or the items array are not available. _items is empty array.
Ext.define('Ace.view.LinkSummaryCarousel', {
extend: 'Ext.Carousel',
xtype : 'linkcarousel',
id : 'linkSummaryCarousel',
requires: ['Ace.view.LinkSummaryGrid', 'Ext.Carousel'],
config: {
title: 'Top Pages',
items: [{
xtype : 'linkgrid',
ufq : 'somedata'
},{
xtype : 'linkgrid',
ufq : 'moredata'
}]
}
});
So everything is loading fine, but I want to only load the store on the viewable grid. I am trying to do it like this in the controller:
refs: [
{ ref : 'carousel', selector: '#linkSummaryCarousel' }
],
init: function() {
this.control({
'#linkSummaryCarousel': {
show : this.onLinkGridRender
}
});
onLinkGridRender : function(me, eOpts) {
console.log('grid render');
//only load active item
//var grid = this.getLinkcarousel();
var grid = this.getLinkcarousel().getActiveItem();
var x = grid.items.first();
if (grid) {
grid.getStore().load({params : {ufq : this.ufq}});
}
},
I have attached a screenshot of what is available when I just execute this.getLinkcarousel(). getActiveItem() or the items array are not available. _items is empty array.