Cross tab hiding columns issue.

(5 posts) (2 voices)
  • Started 1 year ago by ajdjackson
  • Latest reply from ajdjackson
  1. ajdjackson, Member

    Hi

    I hope you can help me with this as it's been driving me nuts for the last couple of hours.

    I have a crosstab and I wish to show/hide a couple of columns before the data columns.

    The inital state of these columns is hidden and I show them by clicking a check box.

    I thought that I had got this working by using td:nth-child(13),td:nth-child(14) etc but what I'm finding is that as well as hiding the 13 and 14th columns, as required, it's also hiding the 13/14th columns in the data columns part of the crosstab.

    This is my code:

    select 'dbr.javascript',"

    $(document).ready(function() {

    $('table.prodruns th:nth-child(13),table.prodruns th:nth-child(14)').hide(); $('table.prodruns td:nth-child(13),table.prodruns td:nth-child(14)').hide(); $('table.prodruns tr th.cell_ct_top.align_c[colspan=14]').attr('colspan',12);

    var $chk = $('#grpChkBox input:checkbox');

    $chk.prop('checked', false);

    $chk.click(function () { var $cspan =$('table.prodruns tr th.cell_ct_top.align_c').prop('colSpan'); $('table.prodruns th:nth-child(13),table.prodruns th:nth-child(14)').toggle(); $('table.prodruns tr td:nth-child(13),table.prodruns tr td:nth-child(14)').toggle(); if ($cspan == 12) { $('table.prodruns tr th.cell_ct_top.align_c[colspan=12]').attr('colspan',14); } else { $('table.prodruns tr th.cell_ct_top.align_c[colspan=14]').attr('colspan',12); }

    });

    // Remove cell titles(tooltips)

    $('table.prodruns tr td').hover(function() { var $desc=' '; $(this).css('cursor','pointer').attr('title', $desc); }, function() { $(this).css('cursor','auto'); });

    // mouse over tooltip for SKU Code and Desc

    $('table.prodruns td:nth-child(4),table.prodruns td:nth-child(5)').hover(function() { var $desc=$(this).text(); $(this).css('cursor','pointer').attr('title', $desc); }, function() { $(this).css('cursor','auto'); });

    });

    ";

    select 'dbr.subtitle','Production Runs'; select 'dbr.crosstab','sDay'; select 'dbr.colstyle','ROrder','[text-align:center;min-width:41px;max-width: 41px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]'; select 'dbr.colstyle','Cust','[min-width:100px;max-width: 100px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]'; select 'dbr.colstyle','FPO','[text-align:center;min-width:40px;max-width: 40px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]'; select 'dbr.colstyle','SKU','[min-width:70px;max-width: 70px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]'; select 'dbr.colstyle','Desc','[text-align:center;min-width:200px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]'; select 'dbr.colstyle','RQty','[text-align:right;min-width:55px;max-width:55px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]%0.0f;[text-align:right;min-width:55px;max-width:55px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]- ;'; select 'dbr.colstyle','MQty','[text-align:right;min-width:55px;max-width:55px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]%0.0f;[text-align:right;min-width:55px;max-width:55px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]- ;'; select 'dbr.colstyle','Comp','[text-align:center;min-width:36px;max-width:36px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]'; select 'dbr.colstyle','HrsUnit','[text-align:right;min-width:45px;max-width:45px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]%0.5f'; select 'dbr.colstyle','CSize','[text-align:right;min-width:40px;max-width:40px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]'; select 'dbr.colstyle','STK','[text-align:center;min-width:30px;max-width:30px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]'; select 'dbr.colstyle','rSftHrs','[text-align:right;min-width:61px;max-width:61px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;]'; select 'dbr.colstyle','rHrs','[text-align:right;min-width:50px;max-width:50px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;border-left:1px solid #CCC;]%0.2f;[text-align:right;min-width:50px;border-left:1px solid #CCC;]-;'; select 'dbr.colstyle','OPut','[text-align:right;min-width:50px;max-width:50px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;border-left:1px solid #CCC;]%0.0f;[text-align:right;min-width:50px;border-left:1px solid #CCC;]-;'; select 'dbr.calc','rSftHrs','([RQty]-[MQty])*[HrsUnit]/[CSize]'; select 'dbr.sum','rHrs'; select 'dbr.hsum','rHrs'; select 'dbr.hsum','OPut'; select 'dbr.css', '.text_green {background-color:#99ff99;font-weight:bold;}'; select 'dbr.css', '.rclass {background-color:red;color:white;} .gclass {background-color:green;color:white;}'; select 'dbr.cellclass', 'rHrs', 'color'; select 'dbr.cellclass', 'STK', 'stock'; select 'dbr.calc','color', "[rHrs]>0 ? 'text_green' : ''"; select 'dbr.calc','OPut','([rHrs]-[AProd])*[CSize]/[HrsUnit]'; select 'dbr.hidecolumn','color'; select 'dbr.hidecolumn','AProd'; select 'dbr.hidecolumn','OrderID'; select 'dbr.hidecolumn','stock'; select 'dbr.lockcolumns','rSftHrs'; select 'dbr.resultclass','prodruns';

    select 'dbr.report','sp_DBR_Sched_Hrs_Detail','[HrsUnit]','popup','inProd=SKU'; select 'dbr.report','sp_DBR_Mat_Req','[STK]','popup','inOrdID=OrderID'; select 'dbr.report', 'sp_DBR_Sched_Edit_Complete','[Comp]','hiddendiv','inOrderID=OrderID','event=click'; select 'dbr.editable','[MQty]', 'sp_DBR_Sched_Edit_Output','inOrderID=OrderID',"options={'callback':mycallback}";

    select a.ROrder as "Priority[ROrder]", a.CustName as "Customer[Cust]", a.sFPO as "FPO #[FPO]", a.SKU as "SKU #[SKU]", a.SKUDesc as "Description[Desc]", a.OQty as "Req.Qty[RQty]", a.MQTY as "Made Qty[MQty]", if(a.Comp = 0,"N","Y") as "Comp.[Comp]", a.budHrs as "Hrs/Unit[HrsUnit]", a.CSize as "Crew #[CSize]", null as "Req.SftHrs[rSftHrs]", if (d.ordGood=1,"Y","N") as "Stk[STK]", c.FPONotes as "FPO Notes[fNotes]", c.AddNotes as "Add. Notes[aNotes]", date_format(b.LineDay,'%d-%a') as "Day[sDay]", b.Hrs_Used as "Hrs[rHrs]", if(b.Hrs_Used>0,b.Hrs_Prod*cover,0) as "[AProd]", null as "Output[OPut]", null as 'color', a.OrderID as "[OrderID]", if (d.ordGood<1,'rclass','gclass') as 'stock'

    from prod_sched a join tblsched_line_day b on a.OrderID=b.FPO join schedule c on a.OrderID = c.OrderID join (select ordID as OID,avg(ordGood) as ordGood from tblsched_mats group by ordID) d on a.OrderID=d.OID order by b.LineDay,a.ROrder;

    select 'dbr.html','<div id="grpChkBox"><p><input type="checkbox" name="notes" /> Show/Hide Notes</p></div>';

    Any help would be most appreciated or is there a better way of doing want I wish?

    Cheers

    Jake

    Posted 1 year ago #
  2. myDBR Team, Key Master

    Probably a better way would be a to find/write a generic table column hide/show jQuery-plugin instead of doing a custom code for a report. Code would be hard to maintain when your report content would change.

    As for the tooltips, check the dbr.tooltip command from latest builds.

    --
    myDBR Team

    Posted 1 year ago #
  3. ajdjackson, Member

    Hi

    Thanks for getting back.

    I'll have a look to see if I can find a plugin.

    I just don't understand why nth-child (13)/(14) is hiding the columns ok but also hiding the next 13/14 columns in the data part of the cross tab. Does dbr.crosstab create cross tabs by stitching 2 tables together?

    With regards to dbr.tooltip I couldn't get it to work. What I found was that mousing over the crosstab columns showed the complete row data. Using the browser's inspector I say that the title attribute was populated with this data. Therefore I'm blanking all the td title attribute and then adding it again just for the columns I wish to see the data.

    Cheers

    Jake

    Posted 1 year ago #
  4. myDBR Team, Key Master

    Jake,
    whan you have a problem, please use SQL export output and use the support email address instead of the forum. For tooltip problem, send in your output (to support email).

    --
    myDBR Team

    Posted 1 year ago #
  5. ajdjackson, Member

    Hi

    Will do. Just sent the export.

    Cheers

    Jake

    Posted 1 year ago #

Reply

You must log in to post.