Hi
You could try this.
Edit the file :
components/com_jamegafilter/assets/js/megafilter.js
~ line : 382
self.ids.sort(function (a, b) {
var v1 = self.getItem(a).getField(self.sortField),
v2 = self.getItem(b).getField(self.sortField);
// transfer array to string
if (Array.isArray(v1)) {
v1.sort();
v1 = v1.join(' ');
}
if (Array.isArray(v2)) {
v2.sort();
v2 = v2.join(' ');
}
if (v1 == v2) {
var t1 = +self.getItem(a).getField('id'),
t2 = +self.getItem(b).getField('id');
return t1 > t2 ? d : -d;
}
if ( !isNaN(v1) && !isNaN(v2) && v1 !== '' && v2 !== '') {
v1 = +v1;
v2 = +v2;
return v1 > v2 ? d : -d;
} else if( v1 && v2 ) {
v1 = v1.split('');
v2 = v2.split('');
var min = Math.min(v1.length, v2.length);
for (var i = 0; i < min; i++) {
if (v1[i] != v2[i]) {
return v1[i].localeCompare(v2[i]) > 0 ? d : -d;
}
}
return v1 > v2 ? d : -d;
}
// let empty value always goes to bottom
if (!v1) {
return d > 0 ? d : -d;
}
if (!v2) {
return d < 0 ? d : -d;
}
});
To
let dump_custom_ordering = [];
if (ja_custom_ordering[self.sortField.replace('frontend_value', 'value')] !== undefined)
dump_custom_ordering = ja_custom_ordering[self.sortField.replace('frontend_value', 'value')];
self.ids.sort(function (a, b) {
var v1 = self.getItem(a).getField(self.sortField),
v2 = self.getItem(b).getField(self.sortField);
// transfer array to string
if (Array.isArray(v1)) {
v1.sort();
// sort items depend on ordering feature in administrator
if (ja_custom_ordering[self.sortField.replace('frontend_value', 'value')] !== undefined) {
let v11 = [];
for (let x in dump_custom_ordering) {
if (v1.indexOf(dump_custom_ordering[x]) !== -1)
v11.push(parseInt(x));
}
if (v11.length)
v1 = v11;
}
v1 = v1.join(' ');
}
if (Array.isArray(v2)) {
v2.sort();
// sort items depend on ordering feature in administrator
if (ja_custom_ordering[self.sortField.replace('frontend_value', 'value')] !== undefined) {
let v11 = [];
for (let x in dump_custom_ordering) {
if (v2.indexOf(dump_custom_ordering[x]) !== -1)
v11.push(parseInt(x));
}
if (v11.length)
v2 = v11;
}
v2 = v2.join(' ');
}
if (v1 == v2) {
var t1 = +self.getItem(a).getField('id'),
t2 = +self.getItem(b).getField('id');
return t1 > t2 ? d : -d;
}
if ( !isNaN(v1) && !isNaN(v2) && v1 !== '' && v2 !== '') {
v1 = +v1;
v2 = +v2;
return v1 > v2 ? d : -d;
} else if( v1 && v2 ) {
v1 = v1.split('');
v2 = v2.split('');
var min = Math.min(v1.length, v2.length);
for (var i = 0; i < min; i++) {
if (v1[i] != v2[i]) {
return v1[i].localeCompare(v2[i]) > 0 ? d : -d;
}
}
return v1 > v2 ? d : -d;
}
// let empty value always goes to bottom
if (!v1) {
return d > 0 ? d : -d;
}
if (!v2) {
return d < 0 ? d : -d;
}
});
That a bit long.
This will include in the next version.
You could wait for next release.