mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 20:28:00 +08:00
Do not apply cuba.web.table.cacheRate for Tables with generated columns #PL-5910
This commit is contained in:
parent
ecea8d6cdc
commit
d92a1e8b66
@ -1878,7 +1878,8 @@ public abstract class WebAbstractTable<T extends com.vaadin.ui.Table & CubaEnhan
|
||||
}
|
||||
}
|
||||
|
||||
protected static class AbbreviatedColumnGenerator implements SystemTableColumnGenerator {
|
||||
protected static class AbbreviatedColumnGenerator implements SystemTableColumnGenerator,
|
||||
CubaEnhancedTable.PlainTextGeneratedColumn {
|
||||
|
||||
protected Table.Column column;
|
||||
|
||||
|
@ -77,4 +77,11 @@ public interface CubaEnhancedTable extends AggregationContainer {
|
||||
interface CellClickListener {
|
||||
void onClick(Object itemId, Object columnId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Marker interface for generated columns which return String value.
|
||||
* Used to work with custom cacheRate and pageLength.
|
||||
*/
|
||||
interface PlainTextGeneratedColumn {
|
||||
}
|
||||
}
|
@ -263,6 +263,13 @@ public class CubaTable extends com.vaadin.ui.Table implements TableContainer, Cu
|
||||
throw new IllegalArgumentException(
|
||||
"Can not add the same GeneratedColumn twice, id:" + id);
|
||||
} else {
|
||||
if (!(generatedColumn instanceof PlainTextGeneratedColumn)) {
|
||||
// do not use custom cache row settings for table with generated columns
|
||||
if (getCacheRate() != 2) {
|
||||
setCacheRate(2);
|
||||
}
|
||||
}
|
||||
|
||||
columnGenerators.put(id, generatedColumn);
|
||||
/*
|
||||
* add to visible column list unless already there (overriding
|
||||
@ -280,6 +287,17 @@ public class CubaTable extends com.vaadin.ui.Table implements TableContainer, Cu
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEditable(boolean editable) {
|
||||
super.setEditable(editable);
|
||||
|
||||
if (editable) {
|
||||
if (getCacheRate() != 2) {
|
||||
setCacheRate(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addShortcutListener(ShortcutListener shortcut) {
|
||||
if (shortcutActionManager == null) {
|
||||
|
@ -333,6 +333,13 @@ public class CubaTreeTable extends com.vaadin.ui.TreeTable implements TreeTableC
|
||||
throw new IllegalArgumentException(
|
||||
"Can not add the same GeneratedColumn twice, id:" + id);
|
||||
} else {
|
||||
if (!(generatedColumn instanceof PlainTextGeneratedColumn)) {
|
||||
// do not use custom cache row settings for table with generated columns
|
||||
if (getCacheRate() != 2) {
|
||||
setCacheRate(2);
|
||||
}
|
||||
}
|
||||
|
||||
columnGenerators.put(id, generatedColumn);
|
||||
/*
|
||||
* add to visible column list unless already there (overriding
|
||||
@ -350,6 +357,17 @@ public class CubaTreeTable extends com.vaadin.ui.TreeTable implements TreeTableC
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEditable(boolean editable) {
|
||||
super.setEditable(editable);
|
||||
|
||||
if (editable) {
|
||||
if (getCacheRate() != 2) {
|
||||
setCacheRate(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean changeVariables(Map<String, Object> variables) {
|
||||
boolean clientNeedsContentRefresh = super.changeVariables(variables);
|
||||
|
Loading…
Reference in New Issue
Block a user