mirror of
https://github.com/DataTables/DataTables.git
synced 2025-02-18 16:54:14 +01:00
New: Column option "sCellType" - allows you to create TD (default) or TH cells for a column. Useful for creating row headings in the TBODY.
This commit is contained in:
parent
732d25b229
commit
ac9e454e11
25
media/js/jquery.dataTables.js
vendored
25
media/js/jquery.dataTables.js
vendored
@ -996,7 +996,7 @@
|
||||
for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
var oCol = oSettings.aoColumns[i];
|
||||
nTd = document.createElement('td');
|
||||
nTd = document.createElement( oCol.sCellType );
|
||||
|
||||
/* Render if needed - if bUseRendered is true then we already have the rendered
|
||||
* value in the data source - so can just use that
|
||||
@ -9972,6 +9972,29 @@
|
||||
"mDataProp": null,
|
||||
|
||||
|
||||
/**
|
||||
* Change the cell type created for the column - either TD cells or TH cells. This
|
||||
* can be useful as TH cells have semantic meaning in the table body, allowing them
|
||||
* to act as a header for a row (you may wish to add scope='row' to the TH elements).
|
||||
* @type string
|
||||
* @default td
|
||||
* @dtopt Columns
|
||||
*
|
||||
* @example
|
||||
* // Make the first column use TH cells
|
||||
* $(document).ready(function() {
|
||||
* var oTable = $('#example').dataTable( {
|
||||
* "aoColumnDefs": [
|
||||
* {
|
||||
* "aTargets": [ 0 ],
|
||||
* "sCellType": "th"
|
||||
* ]
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sCellType": "td",
|
||||
|
||||
|
||||
/**
|
||||
* Class to give to each cell in this column.
|
||||
* @type string
|
||||
|
@ -35,7 +35,7 @@ function _fnCreateTr ( oSettings, iRow )
|
||||
for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
var oCol = oSettings.aoColumns[i];
|
||||
nTd = document.createElement('td');
|
||||
nTd = document.createElement( oCol.sCellType );
|
||||
|
||||
/* Render if needed - if bUseRendered is true then we already have the rendered
|
||||
* value in the data source - so can just use that
|
||||
|
@ -415,6 +415,29 @@ DataTable.defaults.columns = {
|
||||
"mDataProp": null,
|
||||
|
||||
|
||||
/**
|
||||
* Change the cell type created for the column - either TD cells or TH cells. This
|
||||
* can be useful as TH cells have semantic meaning in the table body, allowing them
|
||||
* to act as a header for a row (you may wish to add scope='row' to the TH elements).
|
||||
* @type string
|
||||
* @default td
|
||||
* @dtopt Columns
|
||||
*
|
||||
* @example
|
||||
* // Make the first column use TH cells
|
||||
* $(document).ready(function() {
|
||||
* var oTable = $('#example').dataTable( {
|
||||
* "aoColumnDefs": [
|
||||
* {
|
||||
* "aTargets": [ 0 ],
|
||||
* "sCellType": "th"
|
||||
* ]
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"sCellType": "td",
|
||||
|
||||
|
||||
/**
|
||||
* Class to give to each cell in this column.
|
||||
* @type string
|
||||
|
Loading…
x
Reference in New Issue
Block a user