Merge branch 'datatablessavestate' into 'master'

Add DataTables stateSave feature

See merge request allianceauth/allianceauth!1374
This commit is contained in:
Ariel Rin 2022-01-27 05:05:37 +00:00
commit 2ef3da916b
7 changed files with 23 additions and 4 deletions

View File

@ -193,6 +193,8 @@
"columnDefs": [ "columnDefs": [
{ "sortable": false, "targets": [1] }, { "sortable": false, "targets": [1] },
], ],
"stateSave": true,
"stateDuration": 0
}); });
$('#table-members').DataTable({ $('#table-members').DataTable({
"columnDefs": [ "columnDefs": [
@ -200,6 +202,8 @@
{ "sortable": false, "targets": [0, 2] }, { "sortable": false, "targets": [0, 2] },
], ],
"order": [[ 1, "asc" ]], "order": [[ 1, "asc" ]],
"stateSave": true,
"stateDuration": 0
}); });
$('#table-unregistered').DataTable({ $('#table-unregistered').DataTable({
"columnDefs": [ "columnDefs": [
@ -207,6 +211,8 @@
{ "sortable": false, "targets": [0, 2] }, { "sortable": false, "targets": [0, 2] },
], ],
"order": [[ 1, "asc" ]], "order": [[ 1, "asc" ]],
"stateSave": true,
"stateDuration": 0
}); });
}); });

View File

@ -43,6 +43,9 @@
{% endblock %} {% endblock %}
{% block extra_script %} {% block extra_script %}
$(document).ready(function(){ $(document).ready(function(){
$('#table-search').DataTable(); $('#table-search').DataTable({
"stateSave": true,
"stateDuration": 0
});
}); });
{% endblock %} {% endblock %}

View File

@ -127,6 +127,8 @@
], ],
bootstrap: true bootstrap: true
}, },
"stateSave": true,
"stateDuration": 0
}); });
}); });
{% endblock %} {% endblock %}

View File

@ -104,7 +104,9 @@
"sortable": false, "sortable": false,
"targets": [2] "targets": [2]
}, },
] ],
"stateSave": true,
"stateDuration": 0
}); });
}); });
{% endblock %} {% endblock %}

View File

@ -73,6 +73,8 @@
], ],
bootstrap: true bootstrap: true
}, },
"stateSave": true,
"stateDuration": 0,
drawCallback: function ( settings ) { drawCallback: function ( settings ) {
let api = this.api(); let api = this.api();
let rows = api.rows( {page:'current'} ).nodes(); let rows = api.rows( {page:'current'} ).nodes();

View File

@ -106,8 +106,10 @@
idx: 1 idx: 1
} }
], ],
bootstrap: true bootstrap: true,
}, },
"stateSave": true,
"stateDuration": 0,
drawCallback: function ( settings ) { drawCallback: function ( settings ) {
let api = this.api(); let api = this.api();
let rows = api.rows( {page:'current'} ).nodes(); let rows = api.rows( {page:'current'} ).nodes();

View File

@ -267,7 +267,9 @@ ESC to cancel{% endblocktrans %}"id="blah"></i></th>
"targets": [4, 5], "targets": [4, 5],
"type": "num" "type": "num"
} }
] ],
"stateSave": true,
"stateDuration": 0
}); });
// tooltip // tooltip