Skip to content

Instantly share code, notes, and snippets.

@reachkamrul
Last active September 12, 2020 09:15
Show Gist options
  • Save reachkamrul/675b905f465a96b29725577160d4d1e2 to your computer and use it in GitHub Desktop.
Save reachkamrul/675b905f465a96b29725577160d4d1e2 to your computer and use it in GitHub Desktop.
// This code will hide any row in responsive breakdown which doesn't have any data
// If all rows inside a + icon is empty, it will hide the +/- sign
function runAllThisStaff(){
$table.find('tbody tr').each(function(){
var clickedRow = jQuery(this);
var forCheck = clickedRow.find('td:not(:first-child)');
forCheck.each(function(){
var dataAvailable = jQuery(this).text().length;
if(jQuery(this).text().length === 0){
jQuery(this).remove();
}
})
clickedRow.each(function(i) {
if ($(this).children('td[style="display: none;"]').length == 0) {
$(this).find('.footable-toggle').addClass('empty_sign');
jQuery('.empty_sign').css('color', 'transparent');
}
});
})
}
runAllThisStaff();
$table.on('after.ft.filtering', function() {
runAllThisStaff();
});
$table.on('after.ft.paging', function() {
runAllThisStaff();
});
$table.on('click', 'tbody tr', function(){
jQuery(".footable-details td").each(function(){
var data = jQuery(this).text();
if(data.length === 0){
jQuery(this).parent().remove();
}
})
jQuery('.footable-details tbody').each(function(){
var DataAvailable = jQuery(this).children().length;
if(DataAvailable == 0){
jQuery(this).parents('.footable-detail-row').remove();
}
})
})
@alex-authlab
Copy link

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment