View Full Version : get view by xtype

20 Nov 2014, 1:01 AM
Hi all.

I have a window and I need to access it from my controller with its xtype and show on my Viewport, but I get Uncaught TypeError: Cannot convert undefined or null to object error.

Ext.define('My.view.definition.PropertyToDTWindow', {
extend: 'Ext.window.Window',
requires: ['My.view.definition.PropertyToDTForm'],
alias : 'widget.PropertyToDTWindow',
title: 'Add Property',
closeAction: 'hide',
width: 300,
// id: 'PropertyToDTWindow',
height: 350,
layout: 'fit',
resizable: true,
modal: true,
autoCreate: true,
items: 'propertytodtform',

and here is my controller:

ref: 'PropertyToDTWindow',
selector: '',
xtype: 'PropertyToDTWindow', //view - alias
autoCreate: true

var form = this.getPropertyToDTWindow();
// var form= Ext.getCmp('PropertyToDTWindow');

Can you please help me to find the error cause?

20 Nov 2014, 1:36 AM
on the handler of my button I tried to add the window to my viewport but I still doesn't work

doInsertProperty: function() {
var me = this;
Ext.create('My.view.definition.PropertyToDTWindow', {
renderTo: me.getComponent('manageDTCard').getEl()// <-- itemId of my viewport

20 Nov 2014, 2:59 AM
ok it was my own mistake and the wrong value as a selector!