1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-03-15 16:29:16 +01:00

Merge pull request #84 from timtucker/master

Update to docs
This commit is contained in:
Allan Jardine 2012-08-31 09:46:34 -07:00
commit 0d47107906
3 changed files with 20 additions and 17 deletions

View File

@ -3780,7 +3780,7 @@
* Get the widest node
* @param {object} oSettings dataTables settings object
* @param {int} iCol column of interest
* @returns {string} max string length for each column
* @returns {node} widest table node
* @memberof DataTable#oApi
*/
function _fnGetWidestNode( oSettings, iCol )

View File

@ -1,4 +1,3 @@
/**
* Create a new TR element (and it's TD children) for a row
* @param {object} oSettings dataTables settings object
@ -691,10 +690,12 @@ function _fnAddOptionsHtml ( oSettings )
function _fnDetectHeader ( aLayout, nThead )
{
var nTrs = $(nThead).children('tr');
var nCell;
var i, j, k, l, iLen, jLen, iColShifted;
var nTr, nCell;
var i, k, l, iLen, jLen, iColShifted, iColumn, iColspan, iRowspan;
var bUnique;
var fnShiftCol = function ( a, i, j ) {
while ( a[i][j] ) {
var k = a[i];
while ( k[j] ) {
j++;
}
return j;
@ -711,19 +712,18 @@ function _fnDetectHeader ( aLayout, nThead )
/* Calculate a layout array */
for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
{
var iColumn = 0;
nTr = nTrs[i];
iColumn = 0;
/* For every cell in the row... */
for ( j=0, jLen=nTrs[i].childNodes.length ; j<jLen ; j++ )
{
nCell = nTrs[i].childNodes[j];
nCell = nTr.firstChild;
while ( nCell ) {
if ( nCell.nodeName.toUpperCase() == "TD" ||
nCell.nodeName.toUpperCase() == "TH" )
{
/* Get the col and rowspan attributes from the DOM and sanitise them */
var iColspan = nCell.getAttribute('colspan') * 1;
var iRowspan = nCell.getAttribute('rowspan') * 1;
iColspan = nCell.getAttribute('colspan') * 1;
iRowspan = nCell.getAttribute('rowspan') * 1;
iColspan = (!iColspan || iColspan===0 || iColspan===1) ? 1 : iColspan;
iRowspan = (!iRowspan || iRowspan===0 || iRowspan===1) ? 1 : iRowspan;
@ -732,6 +732,9 @@ function _fnDetectHeader ( aLayout, nThead )
*/
iColShifted = fnShiftCol( aLayout, i, iColumn );
/* Cache calculation for unique columns */
bUnique = iColspan === 1 ? true : false;
/* If there is col / rowspan, copy the information into the layout grid */
for ( l=0 ; l<iColspan ; l++ )
{
@ -739,12 +742,13 @@ function _fnDetectHeader ( aLayout, nThead )
{
aLayout[i+k][iColShifted+l] = {
"cell": nCell,
"unique": iColspan == 1 ? true : false
"unique": bUnique
};
aLayout[i+k].nTr = nTrs[i];
aLayout[i+k].nTr = nTr;
}
}
}
nCell = nCell.nextSibling;
}
}
}

View File

@ -1,5 +1,4 @@
/**
* Convert a CSS unit width to pixels (e.g. 2em)
* @param {string} sWidth width to be converted
@ -284,7 +283,7 @@ function _fnScrollingWidthAdjust ( oSettings, n )
* Get the widest node
* @param {object} oSettings dataTables settings object
* @param {int} iCol column of interest
* @returns {string} max string length for each column
* @returns {node} widest table node
* @memberof DataTable#oApi
*/
function _fnGetWidestNode( oSettings, iCol )