Merge pull request #1780 from fabianfrz/bootgrid_glue

bootgrid glue: make it more robust to errors; handle disabled entries…
This commit is contained in:
Ad Schellevis 2017-09-28 21:07:42 +02:00 committed by GitHub
commit ffb97cd141

View File

@ -76,13 +76,17 @@ function stdBootgridUI(obj, sourceUrl, options) {
{
// scale footer on resize
$(this).find("tfoot td:first-child").attr('colspan',$(this).find("th").length - 1);
$(this).find('tr[data-row-id]').each(function(){
if ($(this).find('[class*="command-toggle"]').first().data("value") == "0") {
$(this).addClass("text-muted");
}
if ($(this).find('[class*="command-boolean"]').first().data("value") == "0") {
$(this).addClass("text-muted");
}
// invert colors if needed (check if there is a disabled field instead of an enabled field
var inverted = $(this).find("thead th[data-column-id=disabled]").length > 0;
$(this).find('tr[data-row-id]').each(function(index, entry){
['[class*="command-toggle"]', '[class*="command-boolean"]'].forEach(function (selector) {
var selected_element = $(entry).find(selector).first();
if (selected_element.length > 0) {
if ((selected_element.data("value") == "0") != inverted ) {
$(entry).addClass("text-muted");
}
}
});
});
})