View Full Version : Grid filter: checkbox value not transferred

28 Jun 2007, 5:30 PM

I got a grid filter setup as:

var filtercntr_hidden = Ext.get(tb.addDom({
tag: 'input'
, type: 'checkbox'
, size: '15'
, value: '1'
, cls: 'x-grid-filter'

My problem is that the value field is always transported as '1', even if the checkbox is not ticked. Conversely, when I leave the value field out, there is an empty value transported, even if the checkbox is ticked.

How do I add a working checkbox filter item to a grid?

Thanks for any help.


28 Jun 2007, 6:03 PM
Don't have to look at the 'checked' property of the dom element for a checkbox?

29 Jun 2007, 1:16 PM

thanks for your comment. I was assuming extjs would post the form field with the checkbox set or not. My backend code also sets the checkbox to checked in certain conditions, but the problem is the same.

Any other ideas?


29 Jun 2007, 2:15 PM
Assuming you're doing Ext.Form.submit, the checkbox value is only submitted when the checked status is true. Not sure what's happening with the toolbar when you add a custom dom element. How are you submitting that?

29 Jun 2007, 4:38 PM

thanks for your help. I use:

filtercntr_hidden: filtercntr_hidden.getValue()

I guess this is pointing me in the right direction.

I have now rebuilt it with Ext.form.Checkbox and getValue() works. For checkbox filters I use:

var filter{FILTER_FIELDNAME} = new Ext.form.Checkbox({
name: 'filter{FILTER_FIELDNAME}',
inputValue: 1

- {FILTER_FIELDNAME} is a placeholder for my fieldname
- tb is my toolbar

Thanks very much for your help!