Merge pull request #1171 from Kamidu/master

Fix git issue https://github.com/wso2/product-iots/issues/1629
revert-70aa11f8
Rasika Perera 7 years ago committed by GitHub
commit 20a7072f90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -117,7 +117,8 @@ $.fn.datatables_extended = function(settings){
} }
else if (filterColumn.eq(column.index()).hasClass('text-filter')) { else if (filterColumn.eq(column.index()).hasClass('text-filter')) {
var title = filterColumn.eq(column.index()).attr('data-for'); var title = filterColumn.eq(column.index()).attr('data-for');
$(filterColumn.eq(column.index()).empty()).html('<input type="text" class="form-control" placeholder="Search ' + title + '" />'); $(filterColumn.eq(column.index()).empty()).html('<input type="text" class="form-control" ' +
'placeholder="Search ' + title + '" />');
filterColumn.eq(column.index()).find('input').on('keyup change', function () { filterColumn.eq(column.index()).find('input').on('keyup change', function () {
column.search($(this).val()).draw(); column.search($(this).val()).draw();
@ -142,10 +143,12 @@ $.fn.datatables_extended = function(settings){
*/ */
var table = this; var table = this;
if (table.hasClass('sorting-enabled')) { if (table.hasClass('sorting-enabled')) {
var dropdownmenu = $('<ul class="dropdown-menu arrow arrow-top-right dark sort-list add-margin-top-2x"><li class="dropdown-header">Sort by</li></ul>'); var dropdownmenu = $('<ul class="dropdown-menu arrow arrow-top-right dark sort-list ' +
'add-margin-top-2x"><li class="dropdown-header">Sort by</li></ul>');
$('.sort-row th', elem).each(function () { $('.sort-row th', elem).each(function () {
if (!$(this).hasClass('no-sort')) { if (!$(this).hasClass('no-sort')) {
dropdownmenu.append('<li><a href="#' + $(this).html() + '" data-column="' + $(this).index() + '">' + $(this).html() + '</a></li>'); dropdownmenu.append('<li><a href="#' + $(this).html() + '" data-column="' + $(this).index() +
'">' + $(this).html() + '</a></li>');
} }
}); });
} }
@ -234,20 +237,20 @@ $.fn.datatables_extended = function(settings){
$('.dataTables_wrapper [data-click-event=toggle-selected]').click(function () { $('.dataTables_wrapper [data-click-event=toggle-selected]').click(function () {
var button = this, var button = this,
thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable();
if(!$(button).hasClass('disabled')){
if ($(button).html() == 'Select All') { if ($(button).html() == 'Select All') {
$(button).html('Deselect All');
$('.bulk-action-row').removeClass('hidden');
thisTable.api().rows().every(function () { thisTable.api().rows().every(function () {
$(this.node()).addClass(rowSelectedClass); $(this.node()).addClass(rowSelectedClass);
$(button).html('Deselect All');
}); });
} }
else if ($(button).html() == 'Deselect All') { else if ($(button).html() == 'Deselect All') {
$('.bulk-action-row').addClass('hidden');
$(button).html('Select All');
thisTable.api().rows().every(function () { thisTable.api().rows().every(function () {
$(this.node()).removeClass(rowSelectedClass); $(this.node()).removeClass(rowSelectedClass);
$(button).html('Select All');
}); });
} }
}
}); });
/** /**
@ -266,7 +269,8 @@ $.fn.datatables_extended = function(settings){
thisTable.api().rows().every(function () { thisTable.api().rows().every(function () {
if (!$(this.node()).hasClass(rowSelectedClass)) { if (!$(this.node()).hasClass(rowSelectedClass)) {
$(button).closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]').html('Select All'); $(button).closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]').
html('Select All');
} }
}); });
}); });

@ -190,7 +190,8 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
}); });
} else if (filterColumn.eq(column.index()).hasClass('text-filter')) { } else if (filterColumn.eq(column.index()).hasClass('text-filter')) {
var title = filterColumn.eq(column.index()).attr('data-for'); var title = filterColumn.eq(column.index()).attr('data-for');
$(filterColumn.eq(column.index()).empty()).html('<input type="text" class="form-control" placeholder="Search ' + title + '" />'); $(filterColumn.eq(column.index()).empty()).html('<input type="text" class="form-control" ' +
'placeholder="Search ' + title + '" />');
//noinspection SpellCheckingInspection //noinspection SpellCheckingInspection
filterColumn.eq(column.index()).find('input').on('keyup', function () { filterColumn.eq(column.index()).find('input').on('keyup', function () {
@ -211,10 +212,12 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
*/ */
var table = this; var table = this;
if (table.hasClass('sorting-enabled')) { if (table.hasClass('sorting-enabled')) {
var dropdownmenu = $('<ul class="dropdown-menu arrow arrow-top-right dark sort-list add-margin-top-2x"><li class="dropdown-header">Sort by</li></ul>'); var dropdownmenu = $('<ul class="dropdown-menu arrow arrow-top-right dark sort-list ' +
'add-margin-top-2x"><li class="dropdown-header">Sort by</li></ul>');
$('.sort-row th', elem).each(function () { $('.sort-row th', elem).each(function () {
if (!$(this).hasClass('no-sort')) { if (!$(this).hasClass('no-sort')) {
dropdownmenu.append('<li><a href="#' + $(this).html() + '" data-column="' + $(this).index() + '">' + $(this).html() + '</a></li>'); dropdownmenu.append('<li><a href="#' + $(this).html() + '" data-column="' + $(this).index() +
'">' + $(this).html() + '</a></li>');
} }
}); });
} }
@ -303,15 +306,17 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable(); thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable();
if (!$(button).hasClass('disabled')) { if (!$(button).hasClass('disabled')) {
if ($(button).html() == 'Select All') { if ($(button).html() == 'Select All') {
$(button).html('Deselect All');
$('.bulk-action-row').removeClass('hidden');
thisTable.api().rows().every(function () { thisTable.api().rows().every(function () {
$(this.node()).addClass(rowSelectedClass); $(this.node()).addClass(rowSelectedClass);
$(button).html('Deselect All');
}); });
} }
else if ($(button).html() == 'Deselect All') { else if ($(button).html() == 'Deselect All') {
$('.bulk-action-row').addClass('hidden');
$(button).html('Select All');
thisTable.api().rows().every(function () { thisTable.api().rows().every(function () {
$(this.node()).removeClass(rowSelectedClass); $(this.node()).removeClass(rowSelectedClass);
$(button).html('Select All');
}); });
} }
} }
@ -333,7 +338,8 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
thisTable.api().rows().every(function () { thisTable.api().rows().every(function () {
if (!$(this.node()).hasClass(rowSelectedClass)) { if (!$(this.node()).hasClass(rowSelectedClass)) {
$(button).closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]').html('Select All'); $(button).closest('.dataTables_wrapper').find('[data-click-event=toggle-selected]').
html('Select All');
} }
}); });
}); });

Loading…
Cancel
Save