PDA

View Full Version : registering custom column type



maestrokame
24 Apr 2011, 6:16 PM
Hi. I'm trying to create my own column xtype. Am I doing something wrong? or I just can't register a Column class?


Ext.reg('mycoltype', Ext.extend(Ext.grid.Column, {
header: "Nombre",
dataIndex: 'nombreDepartamento',
width: 200
}));

new Ext.grid.GridPanel({
....,

columns:[
{ xtype: 'mycoltype' }
]
});

mitchellsimoens
25 Apr 2011, 5:24 AM
If you look at the source for Column.js (under the src/widgets/grid/ folder in the download package) you will see they are extending Ext.grid.Column but never register an xtype.

Opening Column.js up and look at the very bottom of the file, you will see what to do.

maestrokame
25 Apr 2011, 5:53 AM
Thanks for the help.

Problem solved looking at the very bottom of Column.js, and replacing in my javascript


Ext.reg('mycoltype', coltype);

with


Ext.grid.Column.types.mycoltype = coltype;

mitchellsimoens
25 Apr 2011, 5:57 AM
Awesome! And thanks for posting your solution as others may search for it and come across yours.