You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When a DataTable row is in edit mode events from the editors are bubbled up to the table. This creates a situation where using RowClick plugin and DoubleClick plugin will then receive events when the row is in edit mode.
To Reproduce
Use code below.
click on a row (enables edit) and then click in a textbox, (disables edit)
switch to DoubleClick plugin, repeat step 1 but with double clicks
Expected behavior
it seems to me that if a row is in edit mode that events would be blocked from bubbling up
protected AppLayout layout = AppLayout.create("Domino-ui test");
public static DateTimeFormat sdfLongMs = DateTimeFormat.getFormat("MM/dd/yyyy HH:mm:ss.SSS");
class Record {
public Record(int id, String name) { this.id = id; this.name = name; }
int id;
String name;
}
protected LocalListDataStore<Record> ds = new LocalListDataStore<>();
/**
* This is the entry point method.
*/
public void onModuleLoad() {
layout.withContent((parent1, content) -> {
content.appendChild(createTable());
});
body().appendChild(layout);
}
protected DataTable<Record> createTable() {
TableConfig<Record> tableConfig = new TableConfig<>();
tableConfig
.setFixed(true)
.addColumn(ColumnConfig.<Record>create("id", "id")
.setWidth("50px")
.setCellRenderer(
cell -> {
int n = cell.getTableRow().getRecord().id;
return text((n > 0) ? "" + n : "");
})
.setEditableCellRenderer(
cell -> {
IntegerBox box = IntegerBox.create().withValue(cell.getRecord().id);
cell.setDirtyRecordHandler(dirty -> dirty.id = box.getValue());
return box.element();
}))
.addColumn(ColumnConfig.<Record>create("Label", "Label")
.setWidth("250px")
.setCellRenderer(
cell -> {
int n = cell.getTableRow().getRecord().id;
return text((n > 0) ? "" + n : "");
})
.setEditableCellRenderer(
cell -> {
TextBox box = TextBox.create().withValue(cell.getRecord().name);
cell.setDirtyRecordHandler(dirty -> dirty.name = box.getValue());
return box.element();
}))
.addPlugin(new RowClickPlugin<>(row -> {
if (row.isEditable()) row.save();
else row.edit();
}))
;
DataTable<Record> tbl = new DataTable<>(tableConfig, ds);
ArrayList<Record>al = new ArrayList<>();
al.add(new Record(1, "Test 1"));
al.add(new Record(2, "Test 2"));
ds.setData(al);
ds.load();
return tbl;
}
The text was updated successfully, but these errors were encountered:
Please notice that we cant have something like enabled by default, this could lead to different wrong behaviors were we expect the event to propagate and do something, like events that propagate to the body to close opened popups.
We can provide a mechanism to enable and disable this when its is actually need.
TBH, While trying to implement something for this I found that there is nothing I can actually do with a good value behind it and is not complicated, Solutions I thought off ended up more code than what you could do manually to achieve the same result. my suggestion is to do something like this
Describe the bug
When a DataTable row is in edit mode events from the editors are bubbled up to the table. This creates a situation where using RowClick plugin and DoubleClick plugin will then receive events when the row is in edit mode.
To Reproduce
Use code below.
Expected behavior
it seems to me that if a row is in edit mode that events would be blocked from bubbling up
The text was updated successfully, but these errors were encountered: