Api: Fix some nextmatch bugs

- default columns were not properly used if there was no user preference found
- negated column preference caused problems with column order
- missing data for sorting if no column preference set yet
This commit is contained in:
nathangray 2020-01-07 14:36:45 -07:00
parent a9d07620d4
commit 3258121a15

View File

@ -806,7 +806,7 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
negated = this.options.settings.default_cols[0] == "!";
columnPreference = negated ? this.options.settings.default_cols.substring(1) : this.options.settings.default_cols;
}
if(this.options.settings.selectcols)
if(this.options.settings.selectcols && this.options.settings.selectcols.length)
{
columnPreference = this.options.settings.selectcols;
negated = false;
@ -953,7 +953,10 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
_colData[i].width = parseInt(size[colName])+'px';
}
}
if(!negated)
{
_colData[i].order = typeof order[colName] === 'undefined' ? i : order[colName];
}
for(var j = 0; j < columnDisplay.length; j++)
{
if(columnDisplay[j] == colName)
@ -971,7 +974,14 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
return a.order - b.order;
});
_row.sort(function(a,b) {
if(typeof a.colData !== 'undefined' && typeof b.colData !== 'undefined')
{
return a.colData.order - b.colData.order;
}
else if (typeof a.order !== 'undefined' && typeof b.order !== 'undefined')
{
return a.order - b.order;
}
});
},