From 20949ae51a78bacd3c1fba0b103116d0fff6e855 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Sun, 26 May 2013 10:40:29 +0100 Subject: [PATCH] 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. --- media/src/core/core.draw.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/media/src/core/core.draw.js b/media/src/core/core.draw.js index f195e599..33aec81e 100644 --- a/media/src/core/core.draw.js +++ b/media/src/core/core.draw.js @@ -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