|
Re: [neon] is there a new way of setting "checked"-status for table rows in neon? [message #1754604 is a reply to message #1754410] |
Mon, 20 February 2017 14:50   |
Eclipse User |
|
|
|
Nils,
Here is an example showing two ways to correctly add a row and check it at the same time:
@Order(10)
public class SimpleTableField extends AbstractTableField<SimpleTableField.Table> {
@Override
protected int getConfiguredGridH() {
return 10;
}
public class Table extends AbstractTable {
@Override
protected boolean getConfiguredCheckable() {
return true;
}
public TestColumn getTestColumn() {
return getColumnSet().getColumnByClass(TestColumn.class);
}
@Order(10)
public class TestColumn extends AbstractStringColumn {
@Override
protected String getConfiguredHeaderText() {
return "Test";
}
}
}
}
@Order(10)
public class InsertAndCheckMenu extends AbstractMenu {
@Override
protected String getConfiguredText() {
return "Insert and check";
}
@Override
protected void execAction() {
SimpleTableField.Table table = getFieldByClass(SimpleTableField.class).getTable();
// This will work
ITableRow row = table.addRow();
table.getTestColumn().setValue(row, "[1] The date is: " + new Date());
table.checkRow(row, true); // or row.setChecked(true);
// This will not work...
ITableRow row2 = table.createRow();
table.getTestColumn().setValue(row2, "[2] The date is: " + new Date());
row2.setChecked(true);
// ...but now it does
ITableRow row3 = table.addRow(row2);
row3.setChecked(true);
}
}
I'm not quite sure why the "row2" case does not work, but apparently, the checked flag is not considered when a "normal" table row is added to the table (and thus converted to an "internal" table row). I think you have hit a small bug. If we find the time, we will look into this issue. Thanks for bringing it to our attention.
I hope in the mean time, you can work around this problem using one of the above approaches.
Regards,
Beat
|
|
|
|
Powered by
FUDForum. Page generated in 0.54482 seconds