Results 1 to 6 of 6

Thread: Event in child controller damages lookupReference called in parent controller

  1. #1
    Sencha Premium User
    Join Date
    Oct 2016
    Posts
    15

    Default Event in child controller damages lookupReference called in parent controller

    I call lookupReference in viewport (parent) controller and it works, but when I call it after adding any event in panel (child), lookupReference returns null. Is it a bug or I do something wrong?

  2. #2
    Sencha User
    Join Date
    Sep 2014
    Location
    Central Europe
    Posts
    795
    Answers
    103

    Default

    Could you please share piece of the code? Best would be whole code for the view and the controller.

  3. #3
    Sencha Premium User
    Join Date
    Oct 2016
    Posts
    15

    Default

    Parent view:

    Ext.define('Test.view.MainView', {
    extend: 'Ext.container.Viewport',
    alias: 'widget.mainview',


    requires: [
    'Test.view.MainViewViewModel',
    'Test.view.MainViewViewController',
    'Test.view.Main.BreadcrumbPanel',
    'Ext.panel.Panel'
    ],


    controller: 'mainview',
    viewModel: {
    type: 'mainview'
    },
    itemId: 'myviewport',
    layout: 'border',


    items: [
    {
    xtype: 'main.breadcrumbpanel',
    title: '',
    region: 'center'
    }
    ]


    });


    Parent controller:


    Ext.define('Test.view.MainViewViewController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.mainview',


    requires: [
    'Ext.app.route.Route'
    ],


    routes: {
    'home': 'onInitRoute'
    },


    onInitRoute: function() {
    var rootMenu = new Test.view.Content.RootMenuPanel();
    this.menuChange(rootMenu);
    },


    menuChange: function(injectedPanel) {
    var contentPanel = this.lookupReference('mainContentPanel');
    contentPanel.removeAll(true);
    contentPanel.add(injectedPanel);
    }


    });

    Child controller:

    Ext.define('Test.view.Main.BreadcrumbPanelViewController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.main.breadcrumbpanel',


    onPanelShow: function(component, eOpts) {

    }


    });

    this.lookupReference('mainContentPanel') returns null when I add any event to BreadcrumbPanelViewController, for example onPanelShow.
    Child is linked to parent.

  4. #4
    Sencha User
    Join Date
    Sep 2014
    Location
    Central Europe
    Posts
    795
    Answers
    103

    Default

    I can see that you are using this.lookupReference('mainContentPanel');

    But I don't see anywhere where you set-up the reference mainContentPanel you should set this config on your panel.
    http://docs.sencha.com/extjs/6.2.0/c...#cfg-reference

  5. #5
    Sencha Premium User
    Join Date
    Oct 2016
    Posts
    15

    Default

    BreadcrumbPanel view:

    Ext.define('Test.view.Main.BreadcrumbPanel', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.main.breadcrumbpanel',


    requires: [
    'Test.view.Main.BreadcrumbPanelViewModel',
    'Test.view.Main.ContentPanel',
    'Ext.toolbar.Breadcrumb',
    'Ext.tree.Panel'
    ],


    viewModel: {
    type: 'main.breadcrumbpanel'
    },
    layout: 'column',
    title: '',


    items: [
    {
    xtype: 'main.navigationledge',
    columnWidth: 1
    },
    {
    xtype: 'main.contentpanel',
    height: 800,
    title: 'Content Panel',
    columnWidth: 0.75
    }
    ]


    });

    BreadcrumbPanel view has linked Test.view.Main.ContentPanel which has reference: 'mainContentPanel'

    ContentPanel view:

    Ext.define('Test.view.Main.ContentPanel', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.main.contentpanel',


    requires: [
    'Test.view.Main.ContentPanelViewModel'
    ],


    viewModel: {
    type: 'main.contentpanel'
    },
    reference: 'mainContentPanel',
    height: 250,
    header: false,
    title: ' ',


    layout: {
    type: 'vbox',
    align: 'center',
    pack: 'center'
    }


    });

  6. #6
    Sencha User
    Join Date
    Sep 2014
    Location
    Central Europe
    Posts
    795
    Answers
    103

    Default

    I see, hm. Could you create fiddle.sencha.com with the example? You should be able to copy the code from the SA classes. It's the best and fastest way to debug such situations.

Similar Threads

  1. [FIXED] Parent View's controller fails to observe Ext.list.Tree child-component
    By ThorstenSuckow in forum Ext JS 6.x Bugs
    Replies: 1
    Last Post: 18 Jul 2016, 3:12 PM
  2. Replies: 3
    Last Post: 6 Nov 2015, 9:05 AM
  3. Replies: 1
    Last Post: 14 Aug 2015, 12:30 PM
  4. Replies: 1
    Last Post: 1 Jul 2014, 7:17 AM
  5. Replies: 3
    Last Post: 28 Jun 2012, 7:41 AM

Tags for this Thread

Posting Permissions

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