Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82535

conditions in mRender

$
0
0

Hi i am using latest version of datatables.

I want to display some records but with if else-if condition from mRender

$(document).ready( function() {
  var oTable = $('#example').dataTable( {
        "bProcessing": true, 
        "bServerSide": true,
        "sAjaxSource": "test_list_db.php",
    "aoColumnDefs": [ {
      "aTargets": [ 2 ],
      "mData": "null",
      "mRender": function ( data, type, full ) {
                                if(full[20] != 0 ){
                                var status = '<div id="container">\n\
                                        <a href="test_list.php?a='+full[20]+'&ab='+full[21]+'" class="click_'+full[22]+'">\n\
                                        '+full[20]+' - '+full[23]+'  \n\
                                        </a><br \>\n\  </div>';
                                        
                                } else if(full[21] != 0){   //  -- if this record is ZERO then will not be seen 
                               var status = '<div id="container">\n\
                                        <a href="test_list.php?a='+full[0]+'&ab='+full[20]+'" class="click_'+full[0]+'">\n\
                                        '+full[21]+' - '+full[24]+'  \n\
                                        </a><br\>\n\ </div>';
                                } else if(full[22] != 0){
                               var status = '<div id="container">\n\
                                        <a href="test_list.php?a='+full[0]+'&ab='+full[20]+'" class="click_'+full[0]+'">\n\
                                        '+full[22]+' - '+full[25]+'  \n\
                                        </a><br\>\n\ </div>';
                                }
                  return status;
      }
    } ]
  } );
} );

also how i can use if condition under anchor tag of it , i means like :

<a href="test_list.php?a='+full[20]+'&ab='+full[21]+'" class="click_'+full[22]+'">\n\ '+full[20]+' - if (full[23] == 87 ) { '+ echo TESTER +' } \n\ </a>

please note in above if condition "TESTER" is Defines a named constant

but all its not working ...


Viewing all articles
Browse latest Browse all 82535

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>