View Full Version : format checkbox data how to ?

1 Sep 2010, 10:26 AM
how do I display the data for a checkbox well formatted, say as in table.

For example, currently, I add a new Ext.form.Checkbox to a checkbox group.
So, it has to have value like FirstName(EmployeeId).

the check box displays it accordingly besides the squarish tick box.
something like

[] Mac(114678)
[] Tim(123444)
[] Mark(676859)

What I would want it is to display it well formatted on the form.
some thing like

[] Mac 114678
[] Tim 123444
[] Mark 676859

2 Sep 2010, 8:31 AM

2 Sep 2010, 9:59 PM
use a renderer and call a function that could handle the formatting... based on your format you could replace the '(' with a space and just remove the ) through a function.... an example is as so:

renderer: //custom rendering specified inline
function (val){
if (!val) {
val = 'None';
return '<i style="color:#A00;">'+val+'</i>';
} else if (val == 'None') {
return '<i style="color:#A00;">'+val+'</i>';
} else {
return val;

This function just takes the val and formats it.. you could obviously run an function you want with the 'val' that is grabbed

3 Sep 2010, 12:57 AM
The boxLabel of a checkbox can contain HTML, so you only need to add some markup and apply some extra styling.