PDA

View Full Version : [CLOSED] [PR1] Selecting child items via controller



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.

Jamie Avins
31 Oct 2011, 10:35 AM
Thank you for the report.

hallikpapa
14 Nov 2011, 2:22 PM
I didn't notice this on the PR2 list. Is this a deeper problem that may take a longer dev cycle?

Jamie Avins
14 Nov 2011, 2:36 PM
MVC issues in general are being done together as part of a larger refactoring. These related issues are being reviewed as part of that process.

edspencer
15 Dec 2011, 3:26 PM
I don't understand why you are calling grid.items.first() - surely you just want this.getCarousel().getActiveItem().getStore().load() ?

hallikpapa
16 Dec 2011, 8:27 AM
grid.items.first() isn't actually doing anything. I just wanted to see what was contained there. You can see I have this right after:



if (grid) {
grid.getStore().load({params : {ufq : this.ufq}});
}

edspencer
9 Jan 2012, 3:10 PM
Are you sure this is Controller-related? It doesn't look like it...

hallikpapa
9 Jan 2012, 6:27 PM
It sure seems like it, but if it isn't a problem in the controller, it's still got to be a bug. I am trying to get the view so I can get the store that is attached to it, but it is not working as expected. This is how I do it in extjs4 and it works.

Where do you see a problem with the code?

rdougan
23 Jan 2012, 5:12 PM
It's impossible to know what is going on without knowing what your 'grid' class is. If it is just a carousel, you can use carousel.getItems().getAt(0) to get the first item.

hallikpapa
26 Jan 2012, 8:13 AM
The grid class are different instances of the same grid panel plugin I found on these forums for ST. I need to do some more testing, because this same code started working in PR3, and hopefully it still works in PR4.