Fixed ordering columns of tables when columns were reordered

This commit is contained in:
Jan Böhmer 2023-07-08 20:16:52 +02:00
parent f8e299ec56
commit b6dd5bb881
2 changed files with 11 additions and 2 deletions

View file

@ -68,8 +68,6 @@ export default class extends Controller {
stateLoadCallback(settings) {
const data = JSON.parse( localStorage.getItem(this.getStateSaveKey()) );
debugger;
if (data) {
//Do not save the start value (current page), as we want to always start at the first page on a page reload
delete data.start;

View file

@ -72,6 +72,17 @@
}
} else {
request._dt = config.name;
//Try to resolve the original column index when the column was reordered (using the ColReorder plugin)
//Only do this when _ColReorder_iOrigCol is available
if (settings.aoColumns && settings.aoColumns.length && settings.aoColumns[0]._ColReorder_iOrigCol !== undefined) {
if (request.order && request.order.length) {
request.order.forEach(function (order) {
order.column = settings.aoColumns[order.column]._ColReorder_iOrigCol;
});
}
}
$.ajax(typeof config.url === 'function' ? config.url(dt) : config.url, {
method: config.method,
data: request