I use jQuery DataTable to bind and display my data. However, I cannot add the line number to the generated grid from the client side. Here is my code:
HTML
<table id="applications_list" class="table table-bordered datagrid"> <thead> <tr> <th><?php echo __('No.'); ?></th> <th><?php echo __('Application Code'); ?></th> <th><?php echo __('Application Name'); ?></th> <th><?php echo __('Created By'); ?></th> <th><?php echo __('Created Date'); ?></th> <th><?php echo __('Action'); ?></th> </tr> </thead> <tbody> </tbody> </table>
Javascript
$('#applications_list').dataTable({ "bLengthChange": false, "bFilter": true, "bFilter": false, "bProcessing": true, "bServerSide": true, "sPaginationType": "full_numbers", "sAjaxSource": config.siteURL + "/applications/ajax_index", "sServerMethod": "POST", "aoColumns": [ { "mData": null, "bSortable": false }, { "mData": "app_applicationcode", "sName": "app_applicationcode" }, { "mData": "app_applicationname", "sName": "app_applicationname" }, { "mData": "app_createdby", "sName": "app_createdby" }, { "mData": "app_createddate", "sName": "app_createddate" }, { "mData": "app_applicationcode", "bSortable": false, "mRender": function(data) { return '<a href="' + config.siteURL + '/applications/delete/' + data + '" class="confirm_delete"><i class="">x</i></a>' }}, ], "aaSorting": [[ 0, 'asc' ]], });
I read the documentation here , but this will not work. Can someone help me solve this problem?
source share