fixed bug with assigned repository items [fixes SCI-2040]

This commit is contained in:
zmagod 2018-02-12 10:49:35 +01:00
parent 128f15f984
commit 27b7aff3ea

View file

@ -176,7 +176,14 @@ var RepositoryDatatable = (function(global) {
TABLE.column(i).visible(visibility); TABLE.column(i).visible(visibility);
TABLE.setColumnSearchable(i, visibility); TABLE.setColumnSearchable(i, visibility);
} }
oSettings._colReorder.fnOrder(myData.ColReorder); // Datatables triggers this action about 3 times
// sometimes on the first iteration the oSettings._colReorder is null
// and the fnOrder rises an error that breaks the table
// here I added a null guard for that case.
// @todo we need to find out why the tables are loaded multiple times
if( oSettings._colReorder ) {
oSettings._colReorder.fnOrder(myData.ColReorder);
}
TABLE.on('mousedown', function() { TABLE.on('mousedown', function() {
$('#repository-columns-dropdown').removeClass('open'); $('#repository-columns-dropdown').removeClass('open');
}); });
@ -445,15 +452,21 @@ var RepositoryDatatable = (function(global) {
$('#assigned-repo-records').on('click', function() { $('#assigned-repo-records').on('click', function() {
viewAssigned = 'assigned'; viewAssigned = 'assigned';
TABLE.ajax.reload(function() { var promiseReload = new Promise(function(resolve) {
resolve(TABLE.ajax.reload());
});
promiseReload.then(function() {
initRowSelection(); initRowSelection();
}, false); })
}); });
$('#all-repo-records').on('click', function() { $('#all-repo-records').on('click', function() {
viewAssigned = 'all'; viewAssigned = 'all';
TABLE.ajax.reload(function() { var promiseReload = new Promise(function(resolve) {
resolve(TABLE.ajax.reload());
});
promiseReload.then(function() {
initRowSelection(); initRowSelection();
}, false); })
}); });
}; };