From 0e15f858e30f6f4f0f84b5c87ca09b659c0cac4c Mon Sep 17 00:00:00 2001 From: icepower03 Date: Thu, 7 Jan 2016 17:18:18 +0100 Subject: [PATCH] enable js createlement in reder function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this change allows to make this ( cthe click event in particular) { title: "accès bureau de prescription", render: function (data, type, row, meta) { return $('
', { text: "Presc. V5", class: 'ouvrirPrescV5' }) .click(function () { lancerBureau(row); })[0]; } }, beacause i think that in a full javascript data use of datatable it's not logical to work with selector like this: .on('click', 'tbody .ouvrirPrescV5', function () { var dt = monTableau.row($(this).parents('tr')).data(); lancerBureau(dt); }); //the idea is to full manage the contenent of the cell including events // if you have another way to do such, this change is useless but as i see the innerHTML --- js/core/core.draw.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/core/core.draw.js b/js/core/core.draw.js index b5d9779da..4cf3d6db8 100644 --- a/js/core/core.draw.js +++ b/js/core/core.draw.js @@ -48,7 +48,14 @@ function _fnCreateTr ( oSettings, iRow, nTrIn, anTds ) // Need to create the HTML if new, or if a rendering function is defined if ( !nTrIn || oCol.mRender || oCol.mData !== i ) { - nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' ); + var cellData = _fnGetCellData(oSettings, iRow, i, 'display'); + // if the render function of columns creates directly a dom object + if (typeof cellData === 'object') + { + nTd.appendChild(cellData); + } + else + { nTd.innerHTML = cellData; } } /* Add user defined class */