mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-22 22:08:45 +01:00
WIP nextmatch column sorting UI:
- Apply user preference after sorting saved
This commit is contained in:
parent
412502f375
commit
2f5fa5def3
@ -215,6 +215,9 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
|
|||||||
// instance, which can first be created once we have the columns
|
// instance, which can first be created once we have the columns
|
||||||
this.controller = null;
|
this.controller = null;
|
||||||
this.rowProvider = null;
|
this.rowProvider = null;
|
||||||
|
|
||||||
|
// keeps sorted columns
|
||||||
|
this.sortedColumnsList = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1039,7 +1042,7 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
|
|||||||
// Update query value, so data source can use visible columns to exclude expensive sub-queries
|
// Update query value, so data source can use visible columns to exclude expensive sub-queries
|
||||||
var oldCols = this.activeFilters.selectcols ? this.activeFilters.selectcols : [];
|
var oldCols = this.activeFilters.selectcols ? this.activeFilters.selectcols : [];
|
||||||
|
|
||||||
this.activeFilters.selectcols = colDisplay;
|
this.activeFilters.selectcols = this.sortedColumnsList ? this.sortedColumnsList : colDisplay;
|
||||||
|
|
||||||
// We don't need to re-query if they've removed a column
|
// We don't need to re-query if they've removed a column
|
||||||
var changed = [];
|
var changed = [];
|
||||||
@ -1058,7 +1061,7 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
|
|||||||
|
|
||||||
// Save visible columns
|
// Save visible columns
|
||||||
// 'nextmatch-' prefix is there in preference name, but not in setting, so add it in
|
// 'nextmatch-' prefix is there in preference name, but not in setting, so add it in
|
||||||
this.egw().set_preference(app, pref, colDisplay.join(","),
|
this.egw().set_preference(app, pref, this.activeFilters.selectcols.join(","),
|
||||||
// Use callback after the preference gets set to trigger refresh, in case app
|
// Use callback after the preference gets set to trigger refresh, in case app
|
||||||
// isn't looking at selectcols and just uses preference
|
// isn't looking at selectcols and just uses preference
|
||||||
cf_added ? jQuery.proxy(function() {if(this.controller) this.controller.update(true);}, this):null
|
cf_added ? jQuery.proxy(function() {if(this.controller) this.controller.update(true);}, this):null
|
||||||
@ -1506,13 +1509,29 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
|
|||||||
}
|
}
|
||||||
columnMgr.setColumnVisibilitySet(visibility);
|
columnMgr.setColumnVisibilitySet(visibility);
|
||||||
|
|
||||||
var sortedColumnList = [];
|
this.sortedColumnsList = [];
|
||||||
jQuery(select.getDOMNode()).find('li[class^="selcolumn_sortable_"]').each(function(i,v){
|
jQuery(select.getDOMNode()).find('li[class^="selcolumn_sortable_"]').each(function(i,v){
|
||||||
var data_id = v.getAttribute('data-value');
|
var data_id = v.getAttribute('data-value');
|
||||||
if (data_id.match(/^col_/) && visibility[data_id]['visible'])
|
var value = select.getValue();
|
||||||
|
if (data_id.match(/^col_/) && value.indexOf(data_id) != -1)
|
||||||
{
|
{
|
||||||
var col_id = data_id.replace('col_','')
|
var col_id = data_id.replace('col_','')
|
||||||
sortedColumnList.push(self._getColumnName(self.columns[col_id].widget));
|
var col_widget = self.columns[col_id].widget;
|
||||||
|
if (col_widget.customfields)
|
||||||
|
{
|
||||||
|
self.sortedColumnsList.push(col_widget.id);
|
||||||
|
for(var field_name in col_widget.customfields)
|
||||||
|
{
|
||||||
|
if(jQuery.isEmptyObject(col_widget.options.fields) || col_widget.options.fields[field_name] == true)
|
||||||
|
{
|
||||||
|
self.sortedColumnsList.push(et2_customfields_list.prototype.prefix + field_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self.sortedColumnsList.push(self._getColumnName(col_widget));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user