mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
WebAdmin: fix column visibility after reorder
Fixes #1899 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -190,6 +190,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "users",
|
||||
name: "members",
|
||||
defaultContent: "",
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
@@ -210,6 +211,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
},
|
||||
{
|
||||
data: "description",
|
||||
name: "description",
|
||||
visible: false,
|
||||
defaultContent: "",
|
||||
render: function(data, type, row) {
|
||||
@@ -299,10 +301,12 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
$('#table_body').localize();
|
||||
}
|
||||
|
||||
function handleColVisibilityCheckbox(el, index) {
|
||||
function handleColVisibilityCheckbox(el, selector) {
|
||||
let index = dt.column(selector).index();
|
||||
el.off("change");
|
||||
el.prop('checked', dt.column(index).visible());
|
||||
el.on("change", function(e){
|
||||
let index = dt.column(selector).index();
|
||||
dt.column(index).visible($(this).is(':checked'));
|
||||
dt.draw('page');
|
||||
});
|
||||
@@ -315,8 +319,8 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
dt.rows().deselect();
|
||||
dt.search(e.target.value).draw();
|
||||
});
|
||||
handleColVisibilityCheckbox($('#checkColMembers'), 1);
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), 2);
|
||||
handleColVisibilityCheckbox($('#checkColMembers'), "members:name");
|
||||
handleColVisibilityCheckbox($('#checkColDesc'), "description:name");
|
||||
|
||||
const exportButton = $(document.querySelector('[data-table-filter="export"]'));
|
||||
exportButton.on('click', function(e){
|
||||
|
||||
Reference in New Issue
Block a user