View Full Version : Checkbox in grid

16 Dec 2009, 6:25 AM
I’m trying to plug checkbox in EditableGrid.

var checkColumn = new Ext.grid.CheckColumn({
header: 'Indoor?',
dataIndex: 'indoor',
width: 55

var cm = new Ext.grid.ColumnModel({
columns: [checkColumn]

But there is one feature in incoming data:
bools come like 1 or 0, but not like true and false.
I tried to use a such render:

checkColumn.renderer = function(data){
if (data == 1) return
return false;

But in this way, checkbox disappears and comes only text “true” or “flase”
How to prepare data correct ?

16 Dec 2009, 6:32 AM
Modify the field in your store..

16 Dec 2009, 11:47 AM
what do you mean?
What property should I change?

16 Dec 2009, 11:51 AM
use === instead of ==

16 Dec 2009, 2:44 PM
I tried === but it didn't help.
I think it's some mistake in using renderer with Ext.grid.CheckColumn :
when I set Ext.grid.CheckColumn without renderer, all fields are always checked.
But when I add such useless renderer:

checkColumn.renderer = function(data){
return data;

all checkboxes disappear and there is only text( '1' or '0') in that column
Such renderer shouldn't change anything.
So, why it kills checkbox?

17 Dec 2009, 12:16 AM
what do you mean?
What property should I change?

*if* you use a store, modify (convert) the field that contains the boolean.

17 Dec 2009, 1:48 AM
I use Ext.data.Store with Ext.data.JsonReader.
I can't change data format on the server side.
How can I change the field in store?
There is type of field = bool
Should I handle every bool field in store and convert it manual?
I think it's wrong way.

IMHO it is some bug in Ext.grid.CheckColumn with renderer (It described in my previous post)
Or maybe I just don't understand how it works
Did somebody use Ext.grid.CheckColumn with renderer ?
How to solve that problem?

17 Dec 2009, 2:09 AM
allright then, since it's allmost xmas.
reader: new reader([
{name: 'aBoolean', convert: function(v, record){return (v==1?true:false)}}}The code above will set you in the right direction but is not working as is.