Added simple possibility to favorite/unfavorite and delete multiple parts at once.

This commit is contained in:
Jan Böhmer 2020-05-23 19:06:46 +02:00
parent 123b229638
commit 6f6ac0f128
4 changed files with 185 additions and 7 deletions

View file

@ -529,6 +529,7 @@ class AjaxUI {
'className': 'mr-2 btn-light',
"text": "<i class='fa fa-cog'></i>"
}],
"select": $table.data('select') ?? false,
"rowCallback": function( row, data, index ) {
//Check if we have a level, then change color of this row
if (data.level) {
@ -564,6 +565,30 @@ class AjaxUI {
$('#part-card-header').html(title.html());
$(document).trigger('ajaxUI:dt_loaded');
if($table.data('part_table')) {
//@ts-ignore
$('#dt').on( 'select.dt deselect.dt', function ( e, dt, items ) {
let selected_elements = dt.rows({selected: true});
let count = selected_elements.count();
if(count > 0) {
$('#select_panel').removeClass('d-none');
} else {
$('#select_panel').addClass('d-none');
}
$('#select_count').text(count);
let selected_ids_string = selected_elements.data().map(function(value, index) {
return value['id']; }
).join(",");
$('#select_ids').val(selected_ids_string);
} );
}
//Attach event listener to update links after new page selection:
$('#dt').on('draw.dt column-visibility.dt', function() {
ajaxUI.registerLinks();