rows().nodes() selector to get all cells of a column given by name
rows().nodes() selector to get all cells of a column given by name
trucmuche2005
Posts: 71Questions: 22Answers: 2
Hello,
I would like to access each cell of the column named by {name: 'option'} using "columns" parameter to make something like
$(document).ready(function() {
$('#tableMDS').on('xhr.dt', function ( e, settings, json, xhr ) {
initCompleteFunction(settings, json);
} );
...
});
function initCompleteFunction(settings, json){
var api = new $.fn.dataTable.Api( settings );
$( '.myclass', api.rows().nodes() ).something(); // HERE but only for the cells in the 'option' column and not for all cells of the datatable
}
I did not found out how to do this. Could you help me please ?
Many thanks in advance.
T.
This discussion has been closed.
Answers
you are probably using the wrong event.
column render or createdRow. Let us know what you are trying to do to the row/column we probably could come up with a better recommendation
Use
cells().every()
with a suitable column selector:Allan
Thank you very much. I got this which works perfectly now (thanks again !) :
but I can't manage to make the following working :
I tried
$( '.select2', $(this) ).select2();
,$( '.select2', this.to$() ).select2();
but nothing works...Could you help me please once again (I think it's my last question for a moment :-)) ?
Many many thanks in advance !
T.
this
is not a node so no, that wouldn't work.You'd need to use
cells().nodes()
to get the nodes. For example:Allan
Thank youuuuu Allan ! :-) Many many thanks !