1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-11-29 11:24:10 +01:00

New: HTML5 data-* attributes for the TR can be set using DT_RowData

property

- Extending the funtionality of DT_RowId and DT_RowClass, this commit
  adds DT_RowData which utalises jQuery's `$().data()` method to set
  HTML5 data-* attributes, which can be useful for additional meta data.

- This is some what complimentary to using objects as the data source
  where you could just use row().data() to get the data, but this is
  effectively an orthogonal way of getting the data and might be useful
  for existing Javascript libraries.

- It should be noted that the data-sort and data-filter work I'll be
  doing for v1.10 shortly will not interact with this method, that will
  be DOM sourced data only, while this is Ajax / Javascript based only.
  However, if you do want to use data from this source for filtering /
  sorting, its easy to do with `data` - `data: 'DT_RowData.sort'` for
  example.

- This fixes issue #45.
This commit is contained in:
Allan Jardine 2013-05-26 10:40:29 +01:00
parent 2be56a63fc
commit 20949ae51a

View File

@ -37,6 +37,11 @@ function _fnCreateTr ( oSettings, iRow, nTrIn, anTds )
nTr.className += ' '+rowData.DT_RowClass;
}
if ( rowData.DT_RowData )
{
$(nTr).data( rowData.DT_RowData );
}
/* Process each column */
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{