Check box in ListGrid

Hi,
I am using smartGWT 2.3, and i need to have checkbox in my listgrid.

i have implimented it, but all the checkbox’s are coming as checked even if the value is false.

<field name="GR_DIS_HALT_KZ_VALUE_CheckBoxValue"	type="boolean"  />
<field name="GR_DIS_INAK_KZ_VALUE_CheckBoxValue"	type="boolean"   />

java code is

GR_DIS_INAK_KZ_VALUE_CheckBoxValue = new ListGridField("GR_DIS_INAK_KZ_VALUE_CheckBoxValue"," ",60);
			GR_DIS_INAK_KZ_VALUE_CheckBoxValue.setType(ListGridFieldType.BOOLEAN);

from backend java i am passing a boolean variable.

but the value is false, but checkbox’s are coming as checked.

Please help

This is a known issue with 2.3 and was fixed soon after the release. Please pick the latest nightly build, or wait for the 2.4 release.

Thanks.

Thanks for the reply.
where can i get the nightly build
Thanks

www.smartclient.com/builds

thanks
i downloaded the jar file from
http://www.smartclient.com/builds/SmartGWT/2.x/EnterpriseEval/2010-12-17

and i replaced smartgwtee.jar file. but having the same error.
do i need to replace ofther files to.

in the bean i hardcoded “false” but then also it is coming as checked.

Make sure you clean your browser cache and and do a clean rebuild your project.

Thank you all.
it worked. i rebuild the project.

I noticed this wasn’t working when we moved to 2.3 and now we’re on the nightly dated 2011-01-06 and I’m still seeing this issue?

Like the other posters here, you should clear your browser cache and rebuild your project to ensure you don’t have staleness somewhere. Use the full set of steps here - don’t skip any steps or attempt upgrading by just copying .jars around (this will not work).

I think I have upgraded successfully going through the steps, I’ve checked the headers for the various JS files upon startup such as ISC_Core.js etc etc, and they all have the appropriately matching dates with the nightly build that I’m on.

This checkbox is only used in the UI and is not persisted in the database.

This ListGridField is not defined in my Datasource, is this an issue?

It depends on how exactly you’re providing the data. If you’re, for example, providing the value for false as the string “false”, from a boolean perspective, all non-empty strings are true. Provide a Boolean instead.

If that’s not the problem, show the contents of the RPC tab for the server response - this will reveal whether you’re providing valid values.

I am setting both true and false during my onDataArrived() callback like this:

listGridRecord.setAttribute("Select", Boolean.TRUE);
listGridRecord.setAttribute("Select", Boolean.FALSE);

in each case.

The checkbox is functional for me, when I click on it, the click event will perform like expected, we just don’t see the visual check in the box.

We have our application skinned if this matters? I searched the logs for 404 missing images and couldn’t find one related to this issue?

Regular check boxes outside the ListGrid work fine.

Is it possible in your skinning that you’ve set the true and false image to the same image?

The app was skinned quite some time ago, and I haven’t made any changed to the skin since doing the 2 upgrades: 1.x -> 2.3 -> 2.4

It was working fine when we were on 1.x and it broke when we went to SmartGWT Power 2.3.

No skin changes during these upgrades.

in my test case, I have 4 ListGridRecords, 3 of them are marked as true and the last is marked as false using the code I provided above. So I should see 3 check boxes with checks and 1 empty check box.

They all render and 4 empty check boxes.

Can you provide the full path of the checked image and unchecked image so I can verify in my skins?

SC_SNAPSHOT-2011-01-06/PowerEdition Deployment 2011-01-06
GWT 1.7.1
IE 7 Developers Console

Here is how we are using the ListGridField checkbox:

Declaration

final ListGridField selectBox = new ListGridField("Select");
selectBox.setType(ListGridFieldType.BOOLEAN);
selectBox.setDefaultValue(false);
selectBox.setWidth(46);

onRecordClick callback

if(listGridRecord != null) {
     if(listGridRecord.getAttribute("Select") == null
     || !Boolean.parseBoolean(listGridRecord.getAttribute("Select").toString())) {
          listGridRecord.setAttribute("Select", Boolean.TRUE);
}
else {
          listGridRecord.setAttribute("Select", Boolean.FALSE);
}
grid.refreshCell(event.getRecordNum(), event.getFieldNum());
    refreshChartPanel();
}

onDataArrived callback in the ListGrid

if( (listGridRecord.getAttribute("Select") == null
     || !Boolean.parseBoolean(listGridRecord.getAttribute("Select").toString()))
     && i <= 2 ) {
    listGridRecord.setAttribute("Select", Boolean.TRUE);
}
else {
     listGridRecord.setAttribute("Select", Boolean.FALSE);
}

Note - we do not have a corresponding DataSourceField in the DataSource that correlates to this ListGridField like the previous customer (and the Showcase example) has in this thread.

Again, the code functionally works when we click on the check box, the only thing that does work is we see no check in the box when the value is set to Boolean.TRUE.

Please advise.

Can you clarify, are you seeing:

  1. a problem with boolean values returned from the server not rendering properly (we asked for the RPC tab output to troubleshoot this)

  2. a problem where records that have boolean values programmatically set before any grid interactions have occurred

  3. only a problem when boolean values are changed on click or other events

Please clarify which of the above (or what combination of the above) you’re seeing. They would have very different causes. In particular, if this field editable, and is editing triggered by click, you may have an unsaved editValue that is being shown instead of the value of the record (see the Grid Editing overview and also listGridField.canToggle).

  1. No, this ListGridField has no representation in the database, so there is no value being returned from the server in which to initialize this value.

  2. No, we set the value of this ListGridField upon receiving data for the grid by way of onDataArrived callback.

  3. Yes, the ListGridField of type Boolean does not visually show a check, when the value is set to Boolean.TRUE.