Passing arguments to a window in ExtJs 6?

ⅰ亾dé卋堺 提交于 2019-12-11 04:44:31

问题


I would like to a pass a record from a grid to a window that I create,

Ext.create('MyWindow',
    {recordRef: record}).show();

where record is an argument that is passed into my rowdblclick function but when I try to access recordRef (like below) during debugging, it is undefined.

var me = this;
var record = me.getView().recordRef;

The code fragment above is in a controller for MyWindow.js


回答1:


The reason this is happening is probably because you are using an event to access recordRef that is called before the constructor assigns recordRef to your window as a property.

My advice would be to use the show event just to be sure, here is a fiddle: https://fiddle.sencha.com/#view/editor&fiddle/232m




回答2:


You can access custom configs you add to a component with getConfig - in this case it would be this.getConfig('recordRef')

Here's a small fiddle where the custom config is logged to the console, and set to be the window's title.



来源:https://stackoverflow.com/questions/45022475/passing-arguments-to-a-window-in-extjs-6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!