-
29 Mar 2012 12:10 PM #1
Meet the List component in Designer
Meet the List component in Designer
I'm trying to follow Neil Drew's video, "Meet the List component" only I would like to build it in Sencha Designer, and I'm stuck on the controller portion of the tutorial. I cannot reproduce the following code in Designer:
I can list the refs, but not "control:".Code:config:{ refs: { main: 'mainpanel' }, control: { 'presidentlist': { disclose: 'showDetail' } } }, showDetail: function(list, record) { this.getMain().push({ xtype: 'presidentdetail', title: record.fullName(), data: record.getData() }) }
I'm trying to learn something very basic. I want to go from a list view to a detail view and I'm having a hard time finding a tutorial that helps me accomplish this. If anyone can help talk through setting up a controller in Designer that takes me from a list view to a detail view would be very much appreciated.
-Phil
-
29 Mar 2012 12:20 PM #2
These are instructions for build 341. This will be changing in the future to be made more intuitive.
Add a Controller Action to your controller
Set the targetType to Ext.dataview.List
Set the name to disclose
Change the fn name to "showDetail"
Double click the node in the inspector
paste in your source codeAaron Conran
@aconran
Sencha Architect Development Team
-
29 Mar 2012 2:41 PM #3
Thanks, Aaron.
I'm getting closer:
Now when I touch on a list item it alerts touched. However when I change my onListDisclose function to:Code:Ext.define('Presidents.controller.Main', { extend: 'Ext.app.Controller', config: { refs: { id: 'presidentlist' }, control: { "list": { disclose: 'onListDisclose' } } }, onListDisclose: function(list, record, target, index, e, options) { alert('Touched!); } });
I get an error stating, "Object presidents-controller-main-1 has no method 'push'"Code:this.getId().push({ id: 'presidentDetail' });
I'm obviously doing something fundamentally wrong. Thanks for the help.
-
29 Mar 2012 4:25 PM #4
id overlaps with a "real" method called "getId".
You are trying to call the method push on the string "presidents-controller-main-1".Aaron Conran
@aconran
Sencha Architect Development Team
-
30 Mar 2012 7:50 AM #5
I really appreciate the help, thank you.
My controller is working. I am successfully pushing a detail view onto the main navigation view, but the list record details don't seem to be pushed with it. When I tap the disclosure icon on the list, it seems to be pushing a new (or just blank) panel. Any hints to put me in the right direction? Does it have something to do with my controller or should I be looking elsewhere?
Thanks.Code:Ext.define('Presidents.controller.Main', { extend: 'Ext.app.Controller', config: { refs: { main: '#main' }, control: { "list": { disclose: 'onListDisclose' } } }, onListDisclose: function(list, record, target, index, e, options) { this.getMain().push({ main: 'presidentDetail' }); } });
-
30 Mar 2012 7:59 AM #6
It should be:
Then make sure that you've added the proper userAlias ("presidentdetail") on the presidentDetail class.Code:this.getMain().push({ xtype: 'presidentdetail' });Aaron Conran
@aconran
Sencha Architect Development Team


Reply With Quote