PDA

View Full Version : ERROR WITH CHECKOLUMN



near
4 Jan 2012, 2:23 AM
Hi,
I have a problem, with the "xtype": 'checkcolumn'. I can set a column in my grid, whose data index type is a boolean without problem, but when I try to set the column type to 'checkcolumn' I get this error:

Uncaught TypeError: Cannot call method 'substring' of undefined,


Can anybody tell m what's wrong, is it a bug ?

Thank's in avance

Regards
near

Farish
4 Jan 2012, 5:51 AM
What I am using is this:


{ header: 'Column header', dataIndex: 'booleanTypeFieldInStore', width: 135,
renderer: function(value) { // This function converts true and false into checkbox checked or unchecked
if(value == "0" || value == "false")
value = false;
else if(value == "1" || value == "true")
value = true;
return "<input type='checkbox' disabled='disabled'" + (value ? "checked='checked'" : "") + ">";
}
}

It renders an HTML checkbox in the grid cell.

skirtle
4 Jan 2012, 8:36 PM
CheckColumn isn't a part of the core library, it's a UX. That error means that you've forgotten to include the relevant JS file.

near
5 Jan 2012, 1:56 AM
Hi Skirtle,
does the ext-all-debug.js include UX files ?

Farish
5 Jan 2012, 2:06 AM
No. You may include it by putting it in Ext.require:


Ext.require([
// any other things you use
'Ext.ux.CheckColumn'
]);

skirtle
5 Jan 2012, 2:20 AM
Using Ext.require will only help if you have the dynamic loader enabled and the UX files are in the right place.

You'd be better off just including it using a script tag. CheckColumn.js can be found in the ExtJS zip file you downloaded. It's in the directory examples/ux. It also needs a CSS file, CheckHeader.css, and the 2 images mentioned therein.

near
5 Jan 2012, 2:33 AM
thank's guys ! it works !