mirror of
https://github.com/DataTables/DataTables.git
synced 2025-03-15 16:29:16 +01:00
commit
0d47107906
2
media/js/jquery.dataTables.js
vendored
2
media/js/jquery.dataTables.js
vendored
@ -3780,7 +3780,7 @@
|
|||||||
* Get the widest node
|
* Get the widest node
|
||||||
* @param {object} oSettings dataTables settings object
|
* @param {object} oSettings dataTables settings object
|
||||||
* @param {int} iCol column of interest
|
* @param {int} iCol column of interest
|
||||||
* @returns {string} max string length for each column
|
* @returns {node} widest table node
|
||||||
* @memberof DataTable#oApi
|
* @memberof DataTable#oApi
|
||||||
*/
|
*/
|
||||||
function _fnGetWidestNode( oSettings, iCol )
|
function _fnGetWidestNode( oSettings, iCol )
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new TR element (and it's TD children) for a row
|
* Create a new TR element (and it's TD children) for a row
|
||||||
* @param {object} oSettings dataTables settings object
|
* @param {object} oSettings dataTables settings object
|
||||||
@ -691,10 +690,12 @@ function _fnAddOptionsHtml ( oSettings )
|
|||||||
function _fnDetectHeader ( aLayout, nThead )
|
function _fnDetectHeader ( aLayout, nThead )
|
||||||
{
|
{
|
||||||
var nTrs = $(nThead).children('tr');
|
var nTrs = $(nThead).children('tr');
|
||||||
var nCell;
|
var nTr, nCell;
|
||||||
var i, j, k, l, iLen, jLen, iColShifted;
|
var i, k, l, iLen, jLen, iColShifted, iColumn, iColspan, iRowspan;
|
||||||
|
var bUnique;
|
||||||
var fnShiftCol = function ( a, i, j ) {
|
var fnShiftCol = function ( a, i, j ) {
|
||||||
while ( a[i][j] ) {
|
var k = a[i];
|
||||||
|
while ( k[j] ) {
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
return j;
|
return j;
|
||||||
@ -711,19 +712,18 @@ function _fnDetectHeader ( aLayout, nThead )
|
|||||||
/* Calculate a layout array */
|
/* Calculate a layout array */
|
||||||
for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
|
for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
|
||||||
{
|
{
|
||||||
var iColumn = 0;
|
nTr = nTrs[i];
|
||||||
|
iColumn = 0;
|
||||||
|
|
||||||
/* For every cell in the row... */
|
/* For every cell in the row... */
|
||||||
for ( j=0, jLen=nTrs[i].childNodes.length ; j<jLen ; j++ )
|
nCell = nTr.firstChild;
|
||||||
{
|
while ( nCell ) {
|
||||||
nCell = nTrs[i].childNodes[j];
|
|
||||||
|
|
||||||
if ( nCell.nodeName.toUpperCase() == "TD" ||
|
if ( nCell.nodeName.toUpperCase() == "TD" ||
|
||||||
nCell.nodeName.toUpperCase() == "TH" )
|
nCell.nodeName.toUpperCase() == "TH" )
|
||||||
{
|
{
|
||||||
/* Get the col and rowspan attributes from the DOM and sanitise them */
|
/* Get the col and rowspan attributes from the DOM and sanitise them */
|
||||||
var iColspan = nCell.getAttribute('colspan') * 1;
|
iColspan = nCell.getAttribute('colspan') * 1;
|
||||||
var iRowspan = nCell.getAttribute('rowspan') * 1;
|
iRowspan = nCell.getAttribute('rowspan') * 1;
|
||||||
iColspan = (!iColspan || iColspan===0 || iColspan===1) ? 1 : iColspan;
|
iColspan = (!iColspan || iColspan===0 || iColspan===1) ? 1 : iColspan;
|
||||||
iRowspan = (!iRowspan || iRowspan===0 || iRowspan===1) ? 1 : iRowspan;
|
iRowspan = (!iRowspan || iRowspan===0 || iRowspan===1) ? 1 : iRowspan;
|
||||||
|
|
||||||
@ -732,6 +732,9 @@ function _fnDetectHeader ( aLayout, nThead )
|
|||||||
*/
|
*/
|
||||||
iColShifted = fnShiftCol( aLayout, i, iColumn );
|
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 */
|
/* If there is col / rowspan, copy the information into the layout grid */
|
||||||
for ( l=0 ; l<iColspan ; l++ )
|
for ( l=0 ; l<iColspan ; l++ )
|
||||||
{
|
{
|
||||||
@ -739,13 +742,14 @@ function _fnDetectHeader ( aLayout, nThead )
|
|||||||
{
|
{
|
||||||
aLayout[i+k][iColShifted+l] = {
|
aLayout[i+k][iColShifted+l] = {
|
||||||
"cell": nCell,
|
"cell": nCell,
|
||||||
"unique": iColspan == 1 ? true : false
|
"unique": bUnique
|
||||||
};
|
};
|
||||||
aLayout[i+k].nTr = nTrs[i];
|
aLayout[i+k].nTr = nTr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
nCell = nCell.nextSibling;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a CSS unit width to pixels (e.g. 2em)
|
* Convert a CSS unit width to pixels (e.g. 2em)
|
||||||
* @param {string} sWidth width to be converted
|
* @param {string} sWidth width to be converted
|
||||||
@ -284,7 +283,7 @@ function _fnScrollingWidthAdjust ( oSettings, n )
|
|||||||
* Get the widest node
|
* Get the widest node
|
||||||
* @param {object} oSettings dataTables settings object
|
* @param {object} oSettings dataTables settings object
|
||||||
* @param {int} iCol column of interest
|
* @param {int} iCol column of interest
|
||||||
* @returns {string} max string length for each column
|
* @returns {node} widest table node
|
||||||
* @memberof DataTable#oApi
|
* @memberof DataTable#oApi
|
||||||
*/
|
*/
|
||||||
function _fnGetWidestNode( oSettings, iCol )
|
function _fnGetWidestNode( oSettings, iCol )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user