Update nm query when column selection changes, re-query only when columns added

This commit is contained in:
Nathan Gray 2011-10-03 17:14:17 +00:00
parent 3c1bebf3f1
commit 4c593038b0

View File

@ -352,7 +352,10 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
*/ */
_updateUserPreferences: function() { _updateUserPreferences: function() {
var colMgr = this.dataviewContainer.getColumnMgr() var colMgr = this.dataviewContainer.getColumnMgr()
if(this.options.settings.columnselection_pref) { if(!this.options.settings.columnselection_pref) {
this.options.settings.columnselection_pref = this.options.template;
}
var visibility = colMgr.getColumnVisibilitySet(); var visibility = colMgr.getColumnVisibilitySet();
var colDisplay = []; var colDisplay = [];
var colSize = {}; var colSize = {};
@ -379,6 +382,24 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, {
// Save adjusted column sizes // Save adjusted column sizes
egw.set_preference(app, "nextmatch-"+this.options.settings.columnselection_pref+"-size", colSize); egw.set_preference(app, "nextmatch-"+this.options.settings.columnselection_pref+"-size", colSize);
// Update query value, so data source can use visible columns to exclude expensive sub-queries
var oldCols = this.activeFilters.selectcols ? this.activeFilters.selectcols : [];
this.activeFilters.selectcols = colDisplay;
// We don't need to re-query if they've removed a column
var changed = [];
ColLoop:
for(var i = 0; i < colDisplay.length; i++)
{
for(var j = 0; j < oldCols.length; j++) {
if(colDisplay[i] == oldCols[j]) continue ColLoop;
}
changed.push(colDisplay[i]);
}
if(changed.length)
{
this.applyFilters();
} }
}, },