-
19 Oct 2011 12:45 PM #1
[PR1] Selecting child items via controller
[PR1] Selecting child items via controller
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:
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:Code: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' }] } });
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.Code: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}}); } },
-
31 Oct 2011 10:35 AM #2Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,652
- Vote Rating
- 14
Thank you for the report.
-
14 Nov 2011 2:22 PM #3
I didn't notice this on the PR2 list. Is this a deeper problem that may take a longer dev cycle?
-
14 Nov 2011 2:36 PM #4Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,652
- Vote Rating
- 14
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.
-
15 Dec 2011 3:26 PM #5Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
I don't understand why you are calling grid.items.first() - surely you just want this.getCarousel().getActiveItem().getStore().load() ?
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
16 Dec 2011 8:27 AM #6
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:
Code:if (grid) { grid.getStore().load({params : {ufq : this.ufq}}); }
-
9 Jan 2012 3:10 PM #7Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
Are you sure this is Controller-related? It doesn't look like it...
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
-
9 Jan 2012 6:27 PM #8
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?
-
23 Jan 2012 5:12 PM #9
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.
Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
-
26 Jan 2012 8:13 AM #10
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.
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote