PDA

View Full Version : How to show checkbox and its label in one field in xtype:checkcolumn column type



ilawai
24 Jun 2012, 10:57 PM
Hi,
One of my columns of type checkcolumn, i would like to show to the user in this column both, the checkbox and the label - text related to it.
thank you.

Romick
25 Jun 2012, 2:15 AM
I think you just need to ovveride checkcolumn renderer. Like here:


xtype: 'checkcolumn',
renderer: function (val, metadata, record, rowIndex, colIndex, eOpt, treeView){
var cssPrefix = Ext.baseCSSPrefix,
cls = [cssPrefix + 'grid-checkheader' + additionalCls];

if (val && val == 'true') {
cls.push(cssPrefix + 'grid-checkheader-checked' + additionalCls);
}
return '<div class="' + cls.join(' ') + '">&#160;</div><div>Add your label here</div>';
}

ilawai
25 Jun 2012, 6:19 AM
It works really good, thanks alot, but i have additional qiestion (probably trivial) how i can show the text on the same row as checkbox and not under?

ilawai
25 Jun 2012, 6:54 AM
use this line:
return '<div class="' + cls.join(' ') + '">' + record.data["${valueHeader.key}"] + '</div>';