lpz lpz - 7 months ago 45
Ajax Question

Disabled href on datatable script

I have a table that is fill dynamically, im using codeigniter and jquery and a template.
The template is works with datatable.net v1.9 api
I have created this script - The script disabled the column which contain href field, asociated to a condition.
The script works, but the problem is: the return function not work on columns that are paginated.
The script is like that, to repare the loop closure issue

$(function() {
var indice = <?php echo json_encode($acum);?>;
var table = $('#dt_a').DataTable();
var j=0;
var nodes = new Array();//
for(var i = 0; i < indice.length; i++)
{ j=i+1;
nodes.push(table.fnGetData(i )[4]);
function(num) {
return function () {
if(table.fnGetData(num )[4] == 1)
alert('El usuario seleccionado tiene asociado un Loteo, para primero elimine el Loteo para poder eliminar el usuario');
return false; }



Try to disable href in the callback for raw drawn https://datatables.net/reference/option/rowCallback

  rowCallback: function ( row, data, index ) {
    // disable `row` content

row will be html-element tr