Skip to content

Commit

Permalink
Update the filterMultiSelect initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslavlibal authored and radimvaculik committed Jul 19, 2022
1 parent 473192b commit fd25fc9
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions assets/datagrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ if (typeof naja !== "undefined") {
}


var datagridFitlerMultiSelect, datagridGroupActionMultiSelect, datagridShiftGroupSelection, datagridSortable, datagridSortableTree, getEventDomPath,
var datagridFilterMultiSelect, datagridGroupActionMultiSelect, datagridShiftGroupSelection, datagridSortable, datagridSortableTree, getEventDomPath,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

$(document).on('click', '[data-datagrid-confirm]:not(.ajax)', function(e) {
Expand Down Expand Up @@ -808,20 +808,30 @@ dataGridRegisterExtension('datagrid-toggle-inline-add', {
}
});

datagridFitlerMultiSelect = function() {
datagridFilterMultiSelect = function() {
var select = $('.selectpicker').first();

if ($.fn.selectpicker) {
return $.fn.selectpicker.defaults = {
let defaults = $.fn.selectpicker.defaults = {
countSelectedText: select.data('i18n-selected'),
iconBase: '',
tickIcon: select.data('selected-icon-check')
};

$('.selectpicker')
.removeClass('form-select form-select-sm')
.addClass('form-control form-control-sm')
.selectpicker('destroy')
.selectpicker({
iconBase: 'fa'
});

return defaults;
}
};

$(function() {
return datagridFitlerMultiSelect();
return datagridFilterMultiSelect();
});

datagridGroupActionMultiSelect = function() {
Expand Down Expand Up @@ -855,15 +865,7 @@ $(function() {

dataGridRegisterExtension('datagrid.fitlerMultiSelect', {
success: function() {
datagridFitlerMultiSelect();
if ($.fn.selectpicker) {
return $('.selectpicker')
.removeClass('form-select form-select-sm')
.addClass('form-control form-control-sm')
.selectpicker({
iconBase: 'fa'
}).selectpicker('refresh');
}
datagridFilterMultiSelect();
}
});

Expand Down

0 comments on commit fd25fc9

Please sign in to comment.