Skip to content
Snippets Groups Projects
Commit 87cd323a authored by srosse's avatar srosse
Browse files

OO-1480: fix an issue if reset of the columns apply to a table with multi-select enable

parent 53968682
No related branches found
No related tags found
No related merge requests found
...@@ -651,11 +651,23 @@ public class Table extends AbstractComponent { ...@@ -651,11 +651,23 @@ public class Table extends AbstractComponent {
return new ChoiceTableDataModel(isMultiSelect(), allCDs, columnOrder, getTranslator()); return new ChoiceTableDataModel(isMultiSelect(), allCDs, columnOrder, getTranslator());
} }
protected List<Integer> getDefaultVisibleColumns() { /**
* Only use this for reset as it reorder the columns, remove the multi-select column
* and so on...
*
* @return The list of index (without multi select) and reorder to begin with 0
*/
protected List<Integer> getDefaultVisibleColumnsToResetColumnsChoice() {
List<Integer> indexList = new ArrayList<>(); List<Integer> indexList = new ArrayList<>();
for(ColumnDescriptor defaultVisibleCD:defaultVisibleCDs) { for(ColumnDescriptor defaultVisibleCD:defaultVisibleCDs) {
if(defaultVisibleCD instanceof MultiSelectColumnDescriptor) continue;
int index = allCDs.indexOf(defaultVisibleCD); int index = allCDs.indexOf(defaultVisibleCD);
if(index >= 0) { if(isMultiSelect()) {
if(index > 0) {
indexList.add(index - 1);
}
} else {
indexList.add(index); indexList.add(index);
} }
} }
......
...@@ -338,7 +338,7 @@ public class TableController extends BasicController { ...@@ -338,7 +338,7 @@ public class TableController extends BasicController {
applyAndcheckChangedColumnsChoice(ureq, colsChoice.getSelectedRows()); applyAndcheckChangedColumnsChoice(ureq, colsChoice.getSelectedRows());
} else if (event == Choice.EVNT_FORM_RESETED) { } else if (event == Choice.EVNT_FORM_RESETED) {
//sideeffect on table and prefs //sideeffect on table and prefs
List<Integer> visibleCols = table.getDefaultVisibleColumns(); List<Integer> visibleCols = table.getDefaultVisibleColumnsToResetColumnsChoice();
applyAndcheckChangedColumnsChoice(ureq, visibleCols); applyAndcheckChangedColumnsChoice(ureq, visibleCols);
} else { // cancelled } else { // cancelled
cmc.deactivate(); cmc.deactivate();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment