$(document).ready(function() { var wfiGroupbyOpen = $(".wfi-groupby-open")!=null; var wfiGroupbyClose = $(".wfi-groupby-close")!=null; if (wfiGroupbyOpen) { $(".wfi-groupby-open").hide(); $(".wfi-groupby-open").click(function() { var tagTR = $($(this).parents("TR")[0]); var tagTRid = tagTR.context.id.substring(0, tagTR.context.id.indexOf(tagTR.context.id.substr(-2)) ); tagTR.nextUntil('#'+tagTRid+'_C').each(function(index){ if ($(this).context.id.indexOf('desc_')==-1) $(this).show(); }); $(tagTR.siblings('#'+tagTRid+'_C')).show(); if (wfiGroupbyClose) { tagTR.find(".wfi-groupby-close").show(); tagTR.find(".wfi-groupby-close-text").hide() } tagTR.find(".wfi-groupby-open").hide(); tagTR.find(".wfi-groupby-open-text").show(); return false; }); } if (wfiGroupbyClose) { $(".wfi-groupby-close").click( function() { var tagTR = $($(this).parents("TR")[0]); var tagTRid = tagTR.context.id.substring(0, tagTR.context.id.indexOf(tagTR.context.id.substr(-2)) ); tagTR.nextUntil('#'+tagTRid+'_C').each(function(index){ if ($(this).context.id.indexOf('desc_')==-1) $(this).hide(); }); $(tagTR.siblings('#'+tagTRid+'_C')).hide(); tagTR.find(".wfi-groupby-close").hide(); tagTR.find(".wfi-groupby-close-text").html( $(tagTR.siblings('#'+tagTRid+'_C').find("DIV")[0]).html() ); tagTR.find(".wfi-groupby-close-text").show(); if (wfiGroupbyOpen) { tagTR.find(".wfi-groupby-open").show(); tagTR.find(".wfi-groupby-open-text").hide(); } return false; }); } });