SmartGWT 2.2, all the modern browsers.
I have a form with 3 rows.
Each row has 1 statictextitem and 2 buttonitems.
I show/draw the form (with disabled buttons), traverse through an array of records where I enable a row of buttons, if the conditions are right.
If I try to enable all of the buttons, only the first row of buttons will be enabled. If I try to enable the 2nd or 3rd row of buttons, only the first row of buttons will be enabled.
I tried redrawing the buttons/form, but no luck.
I have a form with 3 rows.
Each row has 1 statictextitem and 2 buttonitems.
I show/draw the form (with disabled buttons), traverse through an array of records where I enable a row of buttons, if the conditions are right.
If I try to enable all of the buttons, only the first row of buttons will be enabled. If I try to enable the 2nd or 3rd row of buttons, only the first row of buttons will be enabled.
I tried redrawing the buttons/form, but no luck.
Code:
/* button creation code omitted */
formDF.setFields(skipperAlertTextItem, skipperAlertOnButton, skipperAlertOffButton,
other1TextItem, other1OnButton, other1OffButton,
other2TextItem, other2OnButton, other2OffButton,
disabledSTItem);
for (ListGridRecord record : listGrid.getRecords()) {
final String key = record.getAttributeAsString("Key");
Common.getOutputSettings(key, new IHandleOutputSettings() {
public void updateFormWithData(Record[] records) {
if (records != null && records.length > 0) {
final String desc1 = records[0].getAsString("Description1");
final String desc2 = records[0].getAsString("Description2");
if(desc1 == null || desc1.trim().isEmpty() || desc1.trim().equals("Disabled")) {
disabledKeys.add(key);
disabledSTItem.setTitle("Disabled (" + disabledKeys.size() + ")");
disabledSTItem.redraw();
}
else if(desc1.trim().equals("Skipper alert")) {
skipperAlertKeys.add(key);
// skipperAlertOnButton.setDisabled(false);
// skipperAlertOffButton.setDisabled(false);
skipperAlertTextItem.setTitle("Skipper alert (" + skipperAlertKeys.size() + "): ");
skipperAlertTextItem.redraw();
}
else {
other1Keys.add(key);
// other1OnButton.setDisabled(false);
// other1OffButton.setDisabled(false);
other1TextItem.setTitle("Other 1 (" + other1Keys.size() + "): ");
other1TextItem.redraw();
}
if(desc2 == null || desc2.trim().isEmpty() || desc2.trim().equals("Disabled")) {
disabledKeys.add(key);
disabledSTItem.setTitle("Disabled (" + disabledKeys.size() + ")");
disabledSTItem.redraw();
}
else {
other2Keys.add(key);
// other2OnButton.setDisabled(false); // WTF: karkoli enablam, se bo samo skipperAllertButtoni enablali, ostlai pa ostali disablani; report bug?
// other2OffButton.setDisabled(false);
other2TextItem.setTitle("Other 2 (" + other2Keys.size() + "): ");
other2TextItem.redraw();
}
other2OnButton.setDisabled(false);
other2OffButton.setDisabled(false);
other1OnButton.setDisabled(false);
other1OffButton.setDisabled(false);
skipperAlertOnButton.setDisabled(false);
skipperAlertOffButton.setDisabled(false);
}
}
});
}
Comment