dimanche 8 juin 2014

Listeners on Viewport

On my main View (equal to the ViewPort) I have my main ViewController attached, trying to bind the render event to my ViewController's onRender method like this:

Code:



listeners: {
render: 'onRender',
},

However, it seems like Ext has no idea what I'm talking about when I say "onRender", even though I have a ViewController assigned which I can confirm works, because if I subscribe to any event for any descendent of the ViewPort, then the event forwarding to my ViewController does work.

What might I be doing wrong? Is it not possible to forward events to ViewControllers directly on the container with the ViewController assigned, and that events can only be forwarded for descendant items?


This was the error I received:



  • [COLOR=red !important]Uncaught TypeError: Cannot read property 'onKeyPress' of null ext-all-debug.js:21862[/COLOR]

    • [COLOR=red !important]getFireInfo[/COLOR]ext-all-debug.js:21862

    • [COLOR=red !important]fire[/COLOR]ext-all-debug.js:21842

    • [COLOR=red !important]doFireEvent[/COLOR]ext-all-debug.js:22285

    • [COLOR=red !important]prototype.doFireEvent[/COLOR]ext-all-debug.js:85481

    • [COLOR=red !important]fireEventArgs[/COLOR]ext-all-debug.js:22263

    • [COLOR=red !important]fireEvent[/COLOR]ext-all-debug.js:22235

    • [COLOR=red !important]Ext.define.privates.finishRender[/COLOR]ext-all-debug.js:72970

    • [COLOR=red !important]Ext.define.render[/COLOR]ext-all-debug.js:72713

    • [COLOR=red !important]Ext.define.constructor[/COLOR]ext-all-debug.js:74657

    • [COLOR=red !important]constructor[/COLOR]ext-all-debug.js:7829

    • [COLOR=red !important](anonymous function)[/COLOR]VM3684:3

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.create[/COLOR]ext-all-debug.js:9407

    • [COLOR=red !important]Ext.Base.Ext.apply.create[/COLOR]ext-all-debug.js:6964

    • [COLOR=red !important]Ext.define.initViewport[/COLOR]ext-all-debug.js:100773

    • [COLOR=red !important]Ext.define.onBeforeLaunch[/COLOR]ext-all-debug.js:100718

    • [COLOR=red !important]Ext.define.constructor[/COLOR]ext-all-debug.js:100651

    • [COLOR=red !important]constructor[/COLOR]ext-all-debug.js:7829

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:100881

    • [COLOR=red !important]Ext.env.Ready.invoke[/COLOR]ext-all-debug.js:11210

    • [COLOR=red !important]Ext.env.Ready.invokeAll[/COLOR]ext-all-debug.js:11250

    • [COLOR=red !important]Ext.env.Ready.unblock[/COLOR]ext-all-debug.js:11336

    • [COLOR=red !important]Ext.apply.triggerReady[/COLOR]ext-all-debug.js:11959

    • [COLOR=red !important]Ext.apply.checkReady[/COLOR]ext-all-debug.js:12073

    • [COLOR=red !important]Ext.apply.load[/COLOR]ext-all-debug.js:11810

    • [COLOR=red !important]Ext.apply.require[/COLOR]ext-all-debug.js:11681

    • [COLOR=red !important]Ext.apply.triggerReady[/COLOR]ext-all-debug.js:11931

    • [COLOR=red !important]Ext.apply.checkReady[/COLOR]ext-all-debug.js:12073

    • [COLOR=red !important]Ext.apply.load[/COLOR]ext-all-debug.js:11810

    • [COLOR=red !important]Ext.apply.require[/COLOR]ext-all-debug.js:11681

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:4311

    • [COLOR=red !important]hooks.onBeforeCreated[/COLOR]ext-all-debug.js:86617

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:100629

    • [COLOR=red !important]Ext.apply.callback[/COLOR]ext-all-debug.js:5275

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:11780

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:4495

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.notify[/COLOR]ext-all-debug.js:8761

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.triggerExists[/COLOR]ext-all-debug.js:8734

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.triggerCreated[/COLOR]ext-all-debug.js:8719

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.processCreate[/COLOR]ext-all-debug.js:9059

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.processCreate[/COLOR]ext-all-debug.js:9065

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.create[/COLOR]ext-all-debug.js:9036

    • [COLOR=red !important]Ext.apply.onBeforeCreated[/COLOR]ext-all-debug.js:7866

    • [COLOR=red !important]Ext.apply.doProcess[/COLOR]ext-all-debug.js:7948

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:12205

    • [COLOR=red !important]Ext.apply.callback[/COLOR]ext-all-debug.js:5275

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:11780

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:4495

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.notify[/COLOR]ext-all-debug.js:8761

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.triggerExists[/COLOR]ext-all-debug.js:8734

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.triggerCreated[/COLOR]ext-all-debug.js:8719

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.processCreate[/COLOR]ext-all-debug.js:9059

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.processCreate[/COLOR]ext-all-debug.js:9065

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.create[/COLOR]ext-all-debug.js:9036

    • [COLOR=red !important]Ext.apply.onBeforeCreated[/COLOR]ext-all-debug.js:7866

    • [COLOR=red !important]Ext.apply.doProcess[/COLOR]ext-all-debug.js:7948

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:12205

    • [COLOR=red !important]Ext.apply.load[/COLOR]ext-all-debug.js:11805

    • [COLOR=red !important]Ext.apply.exclude.Manager.select.require[/COLOR]ext-all-debug.js:11699

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:8608

    • [COLOR=red !important](anonymous function)[/COLOR]ext-all-debug.js:12172

    • [COLOR=red !important]Ext.apply.doProcess[/COLOR]ext-all-debug.js:7944

    • [COLOR=red !important]Ext.apply.process[/COLOR]ext-all-debug.js:7933

    • [COLOR=red !important]Ext.Class.ExtClass[/COLOR]ext-all-debug.js:7851

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.create[/COLOR]ext-all-debug.js:9000

    • [COLOR=red !important]Ext.ClassManager.Ext.apply.define[/COLOR]ext-all-debug.js:9464

    • [COLOR=red !important](anonymous function)[/COLOR]







1 commentaire:

  1. You need to define the scope 'controller' in your listener config:

    listeners: {
    render: 'onRender',
    scope: 'controller'
    },

    RépondreSupprimer