jquery - How to loop a dataTable and disable a link on specific rows of it? -
there datatable
:
<div id="tabl"> <table id="table_tabl" class="display striped bordered" data-searching="true"> <thead> <tr> <th>salle</th> <th>table</th> <th>réservée</th> <th>date début</th> <th>date fin</th> <th>action</th> // containing link-buttons "update","delete","register","unregister" </tr> </thead> <tbody></tbody> </table> </div>
$('#table_tabl').datatable({ responsive: true, "olanguage": { "surl": "<?php echo rp_lang ?>fr_fr.txt" }, "processing": true, "serverside": true, ajax: "<?php echo rp_ssp ?>server_processing_reservtables.php", "aocolumndefs": [{ "atargets": [5], "mdata": 5, "mrender": function (data, type, full) { var table_ = '\''+full [0]+'\''; return '<div style="text-align:center;"><a href="restaurantreservation/modifierreservtable/'+ data +'" title="update"><i class="icon-pencil"></i></a>' + '<a href="#" id="staticdialog" onclick="affichedlg('+ data +','+table_+')" style="color: red; font-size: 14px;" title="delete"><i class="icon-cancel-2"></i></a>' + '<a href="restaurantreservation/affecterreservtable/'+ data +'" title="register"><i class="icon-locked"></i></a>' + '<a href="restaurantreservation/annulerreservtable/'+ data +'" title="unregister"><i class="icon-unlocked"></i></a></div>'; }, }], "alengthmenu": [ [10, 25,50,100, -1], [10, 25,50,100, "tout"] ] });
as can see there link-buttons icon-pencil
, icon-cancel-2
, icon-locked
, icon-unlocked
inside action
column. want disable icon-locked
link-button if value of third column réservée
equals oui
. how ?
i not sure can try once below:
$('#table_tabl').datatable({ responsive: true, "olanguage": { "surl": "<?php echo rp_lang ?>fr_fr.txt" }, "processing": true, "serverside": true, ajax: "<?php echo rp_ssp ?>server_processing_reservtables.php", "aocolumndefs": [{ "atargets": [5], "mdata": 5, "mrender": function (data, type, column) { var table_ = '\''+column[0]+'\''; if(column[2] == 'oui'){ return '<div style="text-align:center;"><i class="icon-pencil"></i>' + '<i class="icon-cancel-2"></i>' + '<i class="icon-locked"></i>' + '<i class="icon-unlocked"></i></div>'; }else{ return '<div style="text-align:center;"><a href="restaurantreservation/modifierreservtable/'+ data +'" title="update"><i class="icon-pencil"></i></a>' + '<a href="#" id="staticdialog" onclick="affichedlg('+ data +','+table_+')" style="color: red; font-size: 14px;" title="delete"><i class="icon-cancel-2"></i></a>' + '<a href="restaurantreservation/affecterreservtable/'+ data +'" title="register"><i class="icon-locked"></i></a>' + '<a href="restaurantreservation/annulerreservtable/'+ data +'" title="unregister"><i class="icon-unlocked"></i></a></div>'; } }, }], "alengthmenu": [ [10, 25,50,100, -1], [10, 25,50,100, "tout"] ] });
Comments
Post a Comment