Results 1 to 8 of 8

Thread: Controller Question

  1. #1
    Sencha User
    Join Date
    Sep 2007
    Posts
    118
    Answers
    1

    Default Controller Question

    Hello,
    I am trying to load to add a tab to a tab panel after another tab is rendered. I can load the tab using the add method. When i give the xtype of the view it creates and loads the tab. THen I want to fire an event on the on the views controller. I am requiring this views controller at the start of the app. For some reason none of the controllers events are firing. My code is below. Any reason as to why?

    view:
    Code:
    Ext.define("Vertical.view.tab.Member", {
    	extend: "Ext.grid.Panel",
        alias: "widget.member",
        title: 'Member',
        requires: [
    		"Vertical.model.Member"
        ],
        border: false,
        closable: true,
        loadMask: true,
    	id: "MemberTab",
        tbar: [
                  { xtype: "button", icon: "images/browse/add.png", tooltip: "Add" },
                  { xtype: "button", icon: "images/browse/edit.png", tooltip: "Edit" }
           ],
        columns: [
    				{ dataIndex: "PersonName", header: "Name" },
    				{ header: "Visitation/Notes", dataIndex: "VisitationHTML", sortable: false, width: 60 },
    				{ dataIndex: "Age", header: "Age" },
    				{ dataIndex: "DOB", header: "DOB", xtype: "datecolumn" },
    				{ dataIndex: "JoinDate", header: "JoinDate", xtype: "datecolumn" },
    				{ dataIndex: "SalvationDate", header: "SalvationDate", xtype: "datecolumn" },
    				{ dataIndex: "BaptismDate", header: "BaptismDate", xtype: "datecolumn" }
    			],
        formWindowName: "Member",
        store: { model: "Vertical.model.Member", pageSize: 200, remoteSort: true, buffered: true, sorters: [{ property: "LastName"}] }
    });
    controller:
    Code:
    Ext.define("Vertical.controller.tab.Member", {
        extend: "UX.app.BrowseController",
        views: ["Vertical.view.tab.Member"],
        refs: [
    		{ ref: "tabPanel", selector: "viewport > tabpanel" },
            { ref: "member", selector: "viewport > tabpanel > member" }
    	],
        init: function () {
            this.control({
                "member": {
                    bind: function() {
                       
                    },
                    afterlayout: function (container, layout, eOpts) {
                       
                    }
                },
                "member > toolbar > button[tooltip=Add]": {
                    click: this.handleRecord
                }
            });
        }
    });
    calling code:
    Code:
    var tabPanel = this.getTabPanel();
                        var newTab = tabPanel.add({ xtype: "member", title: "Member", closable: true });
                        newTab.fireEvent("bind", newTab, {});
    Thanks
    Timothy

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    118
    Answers
    1

    Default

    Any suggestions?
    It is almost like there is not a controller attached to the view. The controller I want attached is:
    Vertical.controller.tab.Member
    Do i need to specify that at the creation of the view? I dont on the other views I have created

  3. #3
    Sencha User lucasguaru's Avatar
    Join Date
    May 2011
    Location
    Guaruj, Brazil
    Posts
    77
    Answers
    9

    Default

    I don't see any problem in your code.

    Did you added the controller to your application?
    Code:
    Ext.application({
            name : 'Vertical',
            appFolder : 'js',
        
        controllers: [
            'Vertical.controller.tab.Member'
        ],
        
        launch : function() {
         ...
        }
    });

  4. #4
    Sencha User nextSTEP's Avatar
    Join Date
    Sep 2010
    Posts
    36
    Answers
    1

    Default

    You don't need the prefix in controller declaration, because it's prepended automatically.

    PHP Code:
    controllers: [
            
    'tab.Member'
        
    ], 
    Maybe that's the problem because the prefix occurs twice.

  5. #5
    Sencha User
    Join Date
    Sep 2007
    Posts
    118
    Answers
    1

    Default

    Quote Originally Posted by lucasguaru View Post
    I don't see any problem in your code.

    Did you added the controller to your application?
    Code:
    Ext.application({
            name : 'Vertical',
            appFolder : 'js',
        
        controllers: [
            'Vertical.controller.tab.Member'
        ],
        
        launch : function() {
         ...
        }
    });
    Yes, I have it in the required section of my app.js (application).

  6. #6
    Sencha User
    Join Date
    Sep 2007
    Posts
    118
    Answers
    1

    Default

    Quote Originally Posted by nextSTEP View Post
    You don't need the prefix in controller declaration, because it's prepended automatically.

    PHP Code:
    controllers: [
            
    'tab.Member'
        
    ], 
    Maybe that's the problem because the prefix occurs twice.
    Are you suggesting to remove it from the required section?

  7. #7
    Sencha User lucasguaru's Avatar
    Join Date
    May 2011
    Location
    Guaruj, Brazil
    Posts
    77
    Answers
    9

    Default

    Try change the controller that you extend just to make sure
    Code:
    extend: "UX.app.BrowseController"
    To:
    Code:
    extend : 'Ext.app.Controller'

  8. #8
    Sencha User nextSTEP's Avatar
    Join Date
    Sep 2010
    Posts
    36
    Answers
    1

    Default

    Quote Originally Posted by stratboogie View Post
    Are you suggesting to remove it from the required section?
    No, just for "controllers" or any other ones. Defining it in "requires" requires you to specify the full name.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •