LucasN
LucasN

Reputation: 243

Passing arguments to a window in ExtJs 6?

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

Upvotes: 1

Views: 1519

Answers (2)

Guilherme Lopes
Guilherme Lopes

Reputation: 4760

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

Upvotes: 2

Jaimee
Jaimee

Reputation: 488

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.

Upvotes: 0

Related Questions