PDA

View Full Version : Problem with propertygrid on panel



wyz
29 Oct 2011, 4:49 AM
I'm trying to get a propertygrid on a panel, but I don't get it working. I only want to use it as an example to see how it works, so I don't use anything which is in the context of the other problems on the internet (have searched threw loads of them).

I assume I'm looking too long to my code to see mistakes, so propably the solution is simple as hell..


Ext.define('Ext.ux.ViewProfilePanel', {
extend: 'Ext.form.Panel',
alias: 'widget.viewprofilepanel',
requires: ['*'],

initComponent: function()
{
var _this = this;

var defConfig = {
xtype: 'propertygrid',
flex: 1,
propertyNames: {
username: 'Username',
email: 'E-mail'
},
source: {
"username":"myusername",
"email":"me@email.com"
}
};

Ext.apply(this, defConfig);

this.callParent();
}
});

Thanks in advance!

(BTW: I'm using property names in advance for future work, when I need to parse from JSON data from a database.)

mrfr0g
29 Oct 2011, 9:51 PM
So, it looks like you are extending a form panel, and then trying to extend, at initComponent, the property grid on the extended class. This definitely will not work. If you are just trying to place a property grid on the panel, you should place within the items array.

Using your example:




Ext.define('Ext.ux.ViewProfilePanel', {
extend: 'Ext.form.Panel',
alias: 'widget.viewprofilepanel',
requires: ['*'],
items: [
xtype: 'propertygrid',
flex: 1,
propertyNames: {
username: 'Username',
email: 'E-mail'
},
source: {
"username":"myusername",
"email":"me@email.com"
}
]
});

wyz
30 Oct 2011, 1:14 AM
Thanks, I knew it was a stupid mistake!

(Although you made one as well: you forgot the brackets in items, but I saw it almost immediately luckily.)

mrfr0g
30 Oct 2011, 8:24 AM
Haha, whoops. Sorry about those brackets, glad that you caught it.