- Fix some missing column labels in column selection

- Fix column sorting didn't work
This commit is contained in:
nathan 2022-08-17 15:48:29 -06:00
parent 40bbc53af8
commit dce4ac78fc

View File

@ -1261,7 +1261,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
_widget.iterateOver(function(_widget) _widget.iterateOver(function(_widget)
{ {
const label = self.egw().lang(_widget.label || _widget.empty_label || _widget.options.label || _widget.options.empty_label || ''); const label = self.egw().lang(_widget.label || _widget.emptyLabel || _widget.options.label || _widget.options.empty_label || '');
if(!label) return; // skip empty, undefined or null labels if(!label) return; // skip empty, undefined or null labels
if(!result) if(!result)
{ {
@ -1980,7 +1980,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
{ {
visibility[col.id] = {visible: false}; visibility[col.id] = {visible: false};
} }
} }
const value = selectPopup.value; const value = selectPopup.value;
// Update & remove letter filter // Update & remove letter filter
@ -1997,10 +1997,11 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
} }
self._set_lettersearch(show_letters); self._set_lettersearch(show_letters);
} }
let column = 0; self.sortedColumnsList = [];
for(var i = 0; i < value.length; i++) for(var i = 0; i < value.length; i++)
{ {
// Handle skipped columns // Handle skipped columns
let column = 0;
while(value[i] != "col_" + column && column < columnMgr.columns.length) while(value[i] != "col_" + column && column < columnMgr.columns.length)
{ {
column++; column++;
@ -2009,38 +2010,47 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
{ {
visibility[value[i]].visible = true; visibility[value[i]].visible = true;
} }
let col_name = self._getColumnName(self.columns[column].widget);
// Custom fields are listed seperately in column list, but are only 1 column // Custom fields are listed seperately in column list, but are only 1 column
if(self.columns[column] && self.columns[column].widget.instanceOf(et2_nextmatch_customfields)) if(self.columns[column] && self.columns[column].widget.instanceOf(et2_nextmatch_customfields))
{ {
const cf = self.columns[column].widget.options.customfields; const cf = self.columns[column].widget.options.customfields;
const visible = self.columns[column].widget.options.fields; const visible = self.columns[column].widget.options.fields;
self.sortedColumnsList.push(self.columns[column].widget.id);
// Turn off all custom fields // Turn off all custom fields
for(var field_name in cf) for(var field_name in cf)
{ {
visible[field_name] = false; visible[field_name] = false;
} }
// Turn on selected custom fields - start from 0 in case they're not in order // Turn on selected custom fields
for(let j = 0; j < value.length; j++) for(let j = i; j < value.length; j++)
{ {
if(value[j].indexOf(et2_customfields_list.PREFIX) != 0) if(value[j].indexOf(et2_customfields_list.PREFIX) != 0)
{ {
continue; continue;
} }
self.sortedColumnsList.push(value[j]);
visible[value[j].substring(1)] = true; visible[value[j].substring(1)] = true;
i++; i++;
} }
(<et2_customfields_list><unknown>self.columns[column].widget).set_visible(visible); (<et2_customfields_list><unknown>self.columns[column].widget).set_visible(visible);
} }
else
{
self.sortedColumnsList.push(col_name);
}
} }
columnMgr.setColumnVisibilitySet(visibility); columnMgr.setColumnVisibilitySet(visibility);
// Hide popup // Hide popup
self.selectPopup.toggle(); self.selectPopup.toggle();
self.dataview.updateColumns(); self.dataview.updateColumns();
// Auto refresh // Auto refresh
self._set_autorefresh(selectPopup.autoRefresh); self._set_autorefresh(selectPopup.autoRefresh);
// Set default or clear forced // Set default or clear forced