TCPDF: Rotate Text / Cell in Table Header - tcpdf

I have some trouble with creating a table in TCPDF in which all header columns, except the first and last, should be rotated by 90 degrees (or: the text in that cells should be vertical).
Is there a way to rotate just the test within a cell, not the complete cell itself?
I want the table to look like this:
Thanks for your help.

It's simple one, Please check the following code.
$pdf->StartTransform();
$pdf->Rotate(-90);
$pdf->Cell(0,0,'This is a sample data',1,1,'L',0,'');
$pdf->StopTransform();

I'm working hard in this question in last 2 weeks.
The TCPDF tag works well when calling the Rotate method, but not that I wouldn't like.
My solution was:
Create a method to get X and Y for each column with the TCPDF tag;
After writing a HTML table, you have to set the transformation Rotate of each column that you got, setting a new X and Y, depending of a page header;
To solve, if you have a header replication for each page of your multiple page table, I got the number of pages and set for each page the rotated text.
Now, the code example...
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Test( $ae ) {
if( !isset($this->xywalter) ) {
$this->xywalter = array();
}
$this->xywalter[] = array($this->GetX(), $this->GetY());
}
}
// create new PDF document
$pdf = new MYPDF('L', PDF_UNIT, 'A1', true, 'UTF-8', false);
// set Rotate
$params = $pdf->serializeTCPDFtagParameters(array(90));
// other configs
$pdf->setOpenCell(0);
$pdf->SetCellPadding(0);
$pdf->setCellHeightRatio(1.25);
// create some HTML content
$html = '<table width="100%" border="1" cellspacing="0" cellpadding="5">
<thead>
<tr bgcolor="#E6E6E6">
<th rowspan="2" width="15%" align="center">ATIVIDADES E PROCESSOS</th>
<th rowspan="2" width="10%" align="center" valign="bottom">ASPECTOS</th>
<th rowspan="2" width="10%" align="center">IMPACTOS</th>
<th colspan="3" width="6%" align="center">MEIO</th>
<th rowspan="2" width="3%" align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th colspan="9" width="18%" align="center">CLASSIFICAÇÕES</th>
<th rowspan="2" width="3%" align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th rowspan="2" width="10%" align="center">PROGRAMA</th>
<th rowspan="2" width="10%" align="center">SUBPROGRAMA</th>
<th rowspan="2" width="15%" align="center">AÇÕES DE CONTROLE, MEDIDAS MITIGADORAS, COMPENSATÓRIAS E POTENCIALIZADORAS</th>
</tr>
<tr bgcolor="#E6E6E6">
<th align="center" height="200"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
<th align="center"><tcpdf method="Test" params="'.$params.'" /></th>
</tr>
</thead>
<tr bgcolor="#E6E6E6">
<td colspan="20" align="center">Planejamento</td>
</tr>
<tr bgcolor="#FFFFFF">
<td rowspan="3" width="15%" align="left" bgcolor="#FFFFFF">Divulgação do empreendimento</td>
<td rowspan="2" width="10%" align="left">Oferta de empregos diretos e indiretos</td>
<td rowspan="2" width="10%" align="left">Atração de população para as comunidades do entorno</td>
<td rowspan="2" width="2%" align="center"></td>
<td rowspan="2" width="2%" align="center"></td>
<td rowspan="2" width="2%" align="center">X</td>
<td rowspan="2" width="3%" align="center">AII</td>
<td rowspan="2" width="2%" align="center">-</td>
<td rowspan="2" width="2%" align="center">Ind</td>
<td rowspan="2" width="2%" align="center">T</td>
<td rowspan="2" width="2%" align="center">Mp</td>
<td rowspan="2" width="2%" align="center">Po</td>
<td rowspan="2" width="2%" align="center">D</td>
<td rowspan="2" width="2%" align="center">R</td>
<td rowspan="2" width="2%" align="center">M</td>
<td rowspan="2" width="2%" align="center">M</td>
<td rowspan="2" width="3%" align="center">M</td>
<td width="10%">Programa de Apoio ao Desenvolvimento Socioeconomico da Região</td>
<td width="10%">Subprograma de Apoio ao Desenvolvimento Habitacional</td>
<td width="15%">Coibir ocupação indevida de áreas inadequadas</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>Programa de Comunicação Social</td>
<td> -</td>
<td>Ações de comunicação sobre o empreendimento e questões ambientais</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left">Geração de expectativas na população</td>
<td align="left">Geração de expectativas junto a população</td>
<td align="center"></td>
<td align="center"></td>
<td align="center">X</td>
<td align="center">AII</td>
<td align="center">-</td>
<td align="center">Dir</td>
<td align="center">T</td>
<td align="center">Im</td>
<td align="center">Co</td>
<td align="center">L</td>
<td align="center">R</td>
<td align="center">P</td>
<td align="center">P</td>
<td align="center">B</td>
<td>Programa de Comunicação Social</td>
<td> -</td>
<td>Ações de comunicação sobre o empreendimento e questoes ambientais</td>
</tr>
</table>';
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// array with names of columns
$arr_nomes = array(
array("ABRANGÊNCIA", 8, 59), // array(name, new X, new Y);
array("SIGNIFICÂNCIA", 8, 59),
array("FÃSICO", 4, 52),
array("BIÓTICO", 4, 52),
array("SOCIOECONÔMICO", 4, 52),
array("NATUREZA", 4, 52),
array("ORIGEM", 4, 52),
array("DURAÇÃO", 4, 52),
array("OCORRÊNCIA / TEMPORALIDADE", 4, 52),
array("FREQUÊNCIA", 4, 52),
array("ESPACIALIZAÇÃO", 4, 52),
array("REVERSIBILIDADE", 4, 52),
array("MAGNITUDE", 4, 52),
array("RELEVÂNCIA", 4, 52)
);
// num of pages
$ttPages = $pdf->getNumPages();
for($i=1; $i<=$ttPages; $i++) {
// set page
$pdf->setPage($i);
// all columns of current page
foreach( $arr_nomes as $num => $arrCols ) {
$x = $pdf->xywalter[$num][0] + $arrCols[1]; // new X
$y = $pdf->xywalter[$num][1] + $arrCols[2]; // new Y
$n = $arrCols[0]; // column name
// transforme Rotate
$pdf->StartTransform();
// Rotate 90 degrees counter-clockwise
$pdf->Rotate(90, $x, $y);
$pdf->Text($x, $y, $n);
// Stop Transformation
$pdf->StopTransform();
}
}
// reset pointer to the last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_006.pdf', 'I');

This is an old discussion but I'm still facing this issue. I have made a workaround on my TCPDF fork. http://sourceforge.net/u/mnicolardi/tcpdf/ci/master/tree/
I've added a parameter which informs MultiCell method that it is operating in a 90 degrees rotating environment. In this case it uses $h to move the cell to the right.
The new method prototype is:
public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false,$rotated90Degrees=false)
Usage example:
$pdf->StartTransform();
$pdf->Rotate(90);
$pdf->MultiCell(100, 10, "rotated text", 1, 'C', false, 0, "", "", true, 0, false, true, 0, "T", false, true);
$pdf->StopTransform();
Hope it helps!

Related

Why is <tfoot> only shows in the last page when printing?

I am trying to print a html using dompdf and I am trying to add a footer but the footer only shows only the last page in print view? Is it a chrome bug?
<table class="table table-bordered" cellspacing="0" style="color:black">
<thead>
<tr>
<th scope="col" style="border-top: color: white; border-left: color: white;border-right: color: white;" colspan="4"> </th>
</tr>
<tr class="text-center">
<th scope="col" class="align-middle" ></th>
<th scope="col" class="align-middle text-nowrap">Reference No.: BatStateU-FO-ESO-01</th>
<th scope="col" class="align-middle text-nowrap">Effectivity Date: January 3, 2017</th>
<th scope="col" class="align-middle text-nowrap">Revision No.: 00</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="4">
<p class="title-tab"><input type="checkbox" style=" transform : scale(2);"> Extension Service / Training is requested by clients.</p> <br>
<p class="title-tab"><input type="checkbox" style=" transform : scale(2);" checked> Extension Service / Training is Department’s initiative.</p>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="col" colspan="4"> </th>
</tr>
</tfoot>
</table>

TypeError: cell is undefined[Learn More] jspdf.plugin.autotable.js:690:17

I am converting a table to pdf, if I put the pdf into portrait then the PDF gets generated with no issues.
However the table is quite wide so I need to switch it to landscape, as soon as I do I receive the following error:
TypeError: cell is undefined[Learn More] jspdf.plugin.autotable.js:690:17
Sadly I can't share the table as it is confidential work (hence the local pdf creation) but here is the script I am using.
$('#btnExportPDF').on('click', function(e){
e.preventDefault();
let source = document.getElementById('iframeReport').contentWindow.document.getElementById('tblReport');
$('#divHiddenTable').html(source.outerHTML);
console.log(source);
let doc = new jsPDF({format: 'a4', unit: 'pt', orientation: 'l'});//change l to p and it works
console.log('PDF Obj');
doc.autoTable({html: '#tblReport'});
console.log('PDF autoTable');
doc.save("RegionalDirectorsWriteOffReviewExport.pdf");
console.log('PDF save');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.0.9/jspdf.plugin.autotable.js"></script>
After some more investigation, it appears that if I remove the OFFICE 3 section from the table below it works, but with it in it doesn't.
<table class="table table-striped" id="tblReport">
<thead>
<tr>
<th>Client
Code</th>
<th>Client
Partner</th>
<th>Client
Name</th>
<th> </th>
<th align="center">Billed</th>
<th align="center">WIP
W/O</th>
<th align="center">Profit/
Loss</th>
<th>Recovery</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<tr class="OfficeHeader">
<th colspan="9">City 1</th>
</tr>
<tr>
<td>123456</td>
<td>NAME</td>
<td>COMPANY </td>
<td>WHOAMI</td>
<td class="text-right">2,069.58</td>
<td class="text-right">4,609.66</td>
<td class="text-right">-2,540.08</td>
<td class="text-right">44.89</td>
<td></td>
</tr>
<tr>
<td>45384</td>
<td>NAME</td>
<td>COMPANY 2</td>
<td>WHOAMI</td>
<td class="text-right">195.00</td>
<td class="text-right">4,559.74</td>
<td class="text-right">-4,364.74</td>
<td class="text-right">4.27</td>
<td></td>
</tr>
<tr>
<td>852136</td>
<td>NAME</td>
<td>COMPANY 3</td>
<td> </td>
<td class="text-right">600.00</td>
<td class="text-right">3,109.00</td>
<td class="text-right">-2,509.00</td>
<td class="text-right">19.29</td>
<td></td>
</tr>
<tr>
<td>111</td>
<td>NAME</td>
<td>COMPANY 4</td>
<td>WHOAMI</td>
<td class="text-right">0.00</td>
<td class="text-right">1,677.50</td>
<td class="text-right">-1,677.50</td>
<td class="text-right">0.00</td>
<td></td>
</tr>
<tr>
<td>123654</td>
<td>NAME</td>
<td>COMPANY</td>
<td>WHOAMI</td>
<td class="text-right">0.00</td>
<td class="text-right">1,169.75</td>
<td class="text-right">-1,169.75</td>
<td class="text-right">0.00</td>
<td></td>
</tr>
<tr class="OfficeFooter">
<td colspan="4" class="text-right">Office Totals</td>
<td class="text-right"><div class="double-border">2,864.58</div></td>
<td class="text-right"><div class="double-border">15,125.65</div></td>
<td class="text-right"><div class="double-border">-12,261.07</div></td>
<td colspan="2"><div class="pagebreak"> </div></td>
</tr>
<tr class="OfficeHeader">
<th colspan="9">City 2</th>
</tr>
<tr>
<td>A-569</td>
<td>NAME</td>
<td>COMPANY </td>
<td>WHOIZYOU</td>
<td class="text-right">2,175.00</td>
<td class="text-right">4,361.72</td>
<td class="text-right">-2,186.72</td>
<td class="text-right">49.86</td>
<td>Overrun against a thing that we don't know so can't put here</td>
</tr>
<tr>
<td>D/6666</td>
<td>NAME</td>
<td>COMPANY</td>
<td>WHOIZTHIS</td>
<td class="text-right">1,300.00</td>
<td class="text-right">2,371.01</td>
<td class="text-right">-1,071.01</td>
<td class="text-right">54.82</td>
<td>Taken on from previous prtner and manager</td>
</tr>
<tr class="OfficeFooter">
<td colspan="4" class="text-right">Office Totals</td>
<td class="text-right"><div class="double-border">3,475.00</div></td>
<td class="text-right"><div class="double-border">6,732.73</div></td>
<td class="text-right"><div class="double-border">-3,257.73</div></td>
<td colspan="2"><div class="pagebreak"> </div></td>
</tr>
<tr class="OfficeHeader">
<th colspan="9">OFFICE 3</th>
</tr>
<tr>
<td>GFDGDFGF</td>
<td>NAME</td>
<td>COMPANY </td>
<td>WHO</td>
<td class="text-right">2,910.00</td>
<td class="text-right">8,385.21</td>
<td class="text-right">-5,475.21</td>
<td class="text-right">34.70</td>
<td></td>
</tr>
<tr>
<td>KJHKJHKJ</td>
<td>NAME</td>
<td>COMPANY Limited </td>
<td>WHO</td>
<td class="text-right">2,310.00</td>
<td class="text-right">4,733.76</td>
<td class="text-right">-2,423.76</td>
<td class="text-right">48.79</td>
<td></td>
</tr>
<tr>
<td>OIOUIO</td>
<td>NAM,E</td>
<td>COMPANY</td>
<td>WHOZ</td>
<td class="text-right">0.00</td>
<td class="text-right">2,110.25</td>
<td class="text-right">-2,110.25</td>
<td class="text-right">0.00</td>
<td></td>
</tr>
<tr class="OfficeFooter">
<td colspan="4" class="text-right">Office Totals</td>
<td class="text-right"><div class="double-border">5,220.00</div></td>
<td class="text-right"><div class="double-border">15,229.22</div></td>
<td class="text-right"><div class="double-border">-10,009.22</div></td>
<td colspan="2"><div class="pagebreak"> </div></td>
</tr>
</tbody>
<tfoot>
<tr style="height: 2px !important; overflow: hidden !important;">
<td colspan="4"><div style="line-height: 2px !important; height: 2px !important; font-size: 2px !important; overflow: hidden; !important;"> </div></td>
<td colspan="3"><div style="line-height: 2px !important; height: 2px !important; font-size: 2px !important; background-color: #e7ebee; overflow: hidden !important;"> </div></td>
<td colspan="2"><div style="line-height: 2px !important; height: 2px !important; font-size: 2px !important; overflow: hidden; !important;"> </div></td>
</tr>
<tr>
<td colspan="4" class="text-right">AVG</td>
<td class="text-right">1,319.98</td>
<td class="text-right">3,526.59</td>
<td class="text-right">-2,206.61</td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="4" class="text-right">Totals</td>
<td class="text-right"><div class="double-border">27,719.58</div></td>
<td class="text-right"><div class="double-border">74,058.42</div></td>
<td class="text-right"><div class="double-border">-46,338.84</div></td>
<td colspan="2"> </td>
</tr>
</tfoot>
</table>
example JSFiddle https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.css

Razor declare and use variable syntax

I'm trying to get this razor template working but am having trouble declaring the variables for FDate1,2,3,4,5,etc... correctly.
For example I've just included the first FDate1 at the top. The lower part of my code is working correctly the looping part.
What am i doing incorrectly?
#{
string FDate1 = var row in AME.GridF18.FDate1("SubmissionID='" + TknParams.SubmissionID + "'");
}
<div class="table-responsive">
<table class="table table-striped table-condensed table-bordered" width="100%" border="0">
<tbody>
<tr>
<th colspan="7" scope="col">#FDate1</th>
<th colspan="2" scope="col">#FDate2</th>
<th colspan="2" scope="col">#FDate3</th>
<th colspan="2" scope="col">#FDate4</th>
<th colspan="2" scope="col">#FDate5</th>
<th colspan="2" scope="col">#FDate6</th>
<th colspan="1" scope="col">#FDate7</th>
<th colspan="1" scope="col">#FDate8</th>
}
</tr>
<tr>
<th rowspan="2" scope="col">Project #</th>
<th rowspan="2" scope="col">PW</th>
<th rowspan="2" scope="col">Project Name</th>
<th rowspan="2" scope="col">Type of Work</th>
<th rowspan="2" scope="col">Mile</th>
<th rowspan="2" scope="col">Toll</th>
<th rowspan="2" scope="col">Park</th>
<th colspan="2" scope="col">Monday</th>
<th colspan="2" scope="col">Tuesday</th>
<th colspan="2" scope="col">Wednesday</th>
<th colspan="2" scope="col">Thursday</th>
<th colspan="2" scope="col">Friday</th>
<th scope="col">Saturday</th>
<th scope="col">Sunday</th>
<th scope="col">Total</th>
</tr>
<tr>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col">RT</th>
<th scope="col">OT</th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
</tr>
#foreach (var row in AME.GridF18("SubmissionID='" + TknParams.SubmissionID + "'")) {
<tr>
<td>#row.ProjectNumber</td>
<td><input id="checkBox" type="checkbox"></td>
<td>#row.ProjectName</td>
<td>#row.TypeofWork</td>
<td>#row.Mile</td>
<td>#row.Toll</td>
<td>#row.Park</td>
<td>#row.MonRT</td>
<td>#row.MonOT</td>
<td>#row.TuesRT</td>
<td>#row.TuesOT</td>
<td>#row.WedsRT</td>
<td>#row.WedsOT</td>
<td>#row.ThursRT</td>
<td>#row.ThursOT</td>
<td>#row.FriRT</td>
<td>#row.FriOT</td>
<td>#row.Saturday</td>
<td>#row.Sunday</td>
<td>#row.Total</td>
</tr>
}
</tbody>
</table>
</div>

JQuery UI sortable does not scroll when bottom of list in Firefox

I have a JQuery UI Sortable against a table. In Firefox, when you click and drag a row all the way to bottom Chrome will scroll the list for you, but in Firefox, it just drags off the screen into the nothingness below the last visible row.
This particular table with is within a div with a fixed height.
I am using JQuery 2.1.0 and JQuery UI 1.12.
Here is a code pen:- https://codepen.io/anon/pen/BWVpdE
Here is the HTML:-
<div class="scrollableContainer">
<table>
<thead>
<tr class="ui-state-default">
<th colspan="4">Original</th>
<th colspan="4">table heading</th>
<th colspan="4">table heading</th>
<th colspan="4">table heading</th>
<th colspan="4">table heading</th>
<th colspan="4">Current Pos</th>
</tr>
</thead>
<tfoot>
<tr class="ui-state-default">
<th colspan="4">Original</th>
<th colspan="4">table footer</th>
<th colspan="4">table footer</th>
<th colspan="4">table footer</th>
<th colspan="4">table footer</th>
<th colspan="4">Current Pos</th>
</tr>
</tfoot>
<tbody>
<tr class="ui-state-default">
<th colspan="4">First Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">1</td>
</tr>
<tr class="ui-state-default even">
<th colspan="4">Second Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">2</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Third Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">3</td>
</tr>
<tr class="ui-state-default even">
<th colspan="4">Fourth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">4</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
<tr class="ui-state-default">
<th colspan="4">Fifth Row</th>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">data</td>
<td colspan="4">5</td>
</tr>
</tbody>
</table>
</div>
Here is the SCSS:-
.scrollableContainer {
padding-top:60px;
height: 200px;
position:relative;
}
.scrollArea {
height:100%;
overflow-x:hidden;
overflow-y:auto;
}
table {
border-collapse: collapse;
overflow-x: hidden;
overflow-y: auto;
}
td, th {
background: #fff;
border-width: 0;
border-bottom: 1px solid #B8B8B8;
font-weight: normal !important;
padding: 15px;
text-align: left;
vertical-align: middle;
}
tr.even {
td, th {
background: #f1f1f1;
}
}
thead, tfoot {
text-transform: uppercase;
th {
background: #ccc;
}
}
body {
color: #111;
font-size: 16px;
font-family: sans-serif;
}
Here is the JS:-
$( "table tbody" ).sortable( {
update: function( event, ui ) {
$(this).children().each(function(index) {
$(this).find('td').last().html(index + 1)
});
}
});
OK, so I have found a solution using MutationObserver and getBoundingClientRect.
It is actually, not a great solution, but it works.
Here is the updated JS:-
var observer = null;
// Code taken from: http://stackoverflow.com/a/27263050/1545858
$.expr.filters.offscreen = function(el) {
var rect = el.getBoundingClientRect();
return (rect.x + rect.width) < 0
|| (rect.y + rect.height) < 0
|| (rect.x > window.innerWidth || rect.y > window.innerHeight)
;
};
$( "table tbody" ).sortable( {
start: function(event, ui) {
observer = new MutationObserver(function(mutations) {
window.requestAnimationFrame(function() {
if (mutations[0].attributeName === 'style') {
if (ui.item.is(':offscreen')) {
window.requestAnimationFrame(function () {
ui.item[0].scrollIntoView();
});
}
}
});
});
observer.observe(ui.item[0], { attributes: true });
},
stop: function(event, ui) {
observer.disconnect();
},
update: function( event, ui ) {
$(this).children().each(function(index) {
$(this).find('td').last().html(index + 1)
});
}
});
If anyone can let me know why I have to do this, it would be good. I have a feeling it is a bug in JQuery/JQuery UI/Firefox, but I don't know why.
Thanks.

Graphviz: Node internal orientation

The following graphviz code:
digraph g {
labelloc="t";
label="Feed creation process";
graph [
rankdir = "LR"
];
node [
fontsize = "16"
shape = "record"
];
edge [];
abc [shape=none, margin=0, rankdir=""
label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR><TD ROWSPAN="3"><FONT COLOR="red">hello</FONT><BR/>world</TD>
<TD COLSPAN="3">b</TD>
<TD ROWSPAN="3" BGCOLOR="lightgrey">g</TD>
<TD ROWSPAN="3">h</TD>
</TR>
<TR><TD>c</TD>
<TD PORT="here">d</TD>
<TD>e</TD>
</TR>
<TR><TD COLSPAN="3">f</TD>
</TR>
</TABLE>>];
}
Gives:
I'd like to rotate the table orientation 90° clockwise, so that the rows will be:
hello world will be on top
f, 'c|d|eandbon the row below, 'c|d|e aligned vertically
g
h
For example (with the text wrongly oriented!):
Is there a way to rotate the node internals without affecting the order of the nodes in the graph?
I've played with the HTML COLSPAN and ROWSPAN and got:
abc2 [shape=none, margin=0, orientation=120.0,
label=
<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD COLSPAN="3"><FONT COLOR="red">HELLO</FONT><BR/>world</TD>
</TR>
<TR>
<TD ROWSPAN="3">b</TD>
<TD>c</TD>
<TD ROWSPAN="3">f</TD>
</TR>
<TR>
<TD PORT="here">d</TD>
</TR>
<TR>
<TD>e</TD>
</TR>
<TR>
<TD COLSPAN="3" BGCOLOR="lightgrey">g</TD>
</TR>
<TR>
<TD COLSPAN="3">h</TD>
</TR>
</TABLE>
>
];

Resources