Hi DataTables
Having a issue with fnReloadAjax where the table is not being refreshed. I have added the function "fnReloadAjax" in a seperate .js file and can debug trhough the code to see that it is actually gets to the function. But no referesh! any suggestions would be great
Here is my code
Having a issue with fnReloadAjax where the table is not being refreshed. I have added the function "fnReloadAjax" in a seperate .js file and can debug trhough the code to see that it is actually gets to the function. But no referesh! any suggestions would be great
Here is my code
$(document).ready(function () { $.ajax({ type: "POST", url: "../services/users/users.asmx/getallusers", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { $('#divquicksearch').html('<table cellpadding="0" cellspacing="0" border="0" id="quicksearchtable" class="responsive dynamicTable display table table-bordered"></table>'); var data = jQuery.parseJSON(response.d); $('#quicksearchtable').dataTable({ "bProcessing": true, "sDom": "'<'row-fluid'<'span3'l>RCTfrtip'", "bPaginate": true, "sPaginationType": "full_numbers", "aaData": data, "oColVis": { "buttonText": "Show / Hide Columns", "bRestore": true, "sRestore": "Revert Back", "activate": "click" }, "oColReorder": { "iFixedColumns": 1 }, "aoColumns": [ { "mData": "0", "sTitle": "Employee Code", "bSearchable": true, "bVisible": true, "sWidth": "8%", "sClass": "cls-employeeID" }, { "mData": "1", "sTitle": "Store Number", "bSearchable": true, "bVisible": true, "sWidth": "5%" }, { "mData": "2", "sTitle": "Name", "bSearchable": true, "bVisible": true, "sWidth": "15%" }, { "mData": "3", "sTitle": "JobTitle", "bSearchable": true, "bVisible": true, "sWidth": "20%" }, { "mData": "4", "sTitle": "Basic Hours", "bSearchable": true, "bVisible": true, "sWidth": "5%" }, { "mData": null, "sTitle": "Actions", "sWidth": "20%", "sClass": "user-actions" }, ], "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) { //debugger; $('td:eq(5)', nRow).html('<div class="controls center"><a class="tip" href="#" oldtitle="Edit task" title="" aria-describedby="ui-tooltip-8"><span class="icon12 icomoon-icon-pencil"></span></a><a class="tip user-delete" href="#" oldtitle="Remove task" employeename="' + aData[2] + '" employeeID="' + aData[0] + '"><span class="icon12 icomoon-icon-remove "></span></a></div>'); $('td:eq(5)', nRow).attr('employeeID', aData[0]); } }); $.pnotify({ type: 'success', title: 'User Load', text: 'All Users Were Sucessfully loaded', icon: 'picon icon16 iconic-icon-check-alt white', opacity: 0.95, hide: true, history: false, sticker: false }); }, error: function (data) { $.pnotify({ title: 'Error', text: 'There was an error deleteing thi user pplease contact a member of Store Systems', hide: false, icon: 'picon icon16 entypo-icon-warning white', opacity: 0.95, history: false, sticker: false }); } }); $('.user-delete').live('click', function () { var id = $(this).attr('employeeid'); var employeename = $(this).attr('employeename'); $('#userid').append(" " + employeename + " ?"); $('#myModal').modal({ show: true }); $('#confirmDeleteUser').live('click', function () { $.ajax({ type: "POST", url: "../services/users/users.asmx/DeleteUser", data: '{"EmployeeCode": "' + id + '"}', contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { //debugger; var oTable = $('#quicksearchtable').dataTable(); // Immediately remove the first row oTable.fnReloadAjax(); $.pnotify({ type: 'success', title: 'User Deleted', text: 'The user ' + employeename + ' was sucessfully deleted', icon: 'picon icon16 iconic-icon-check-alt white', opacity: 0.95, hide: true, history: false, sticker: false }); }, error: function () { $.pnotify({ type: 'error', title: 'User Deleted', text: 'The user ' + employeename + ' was sucessfully deleted', icon: 'picon icon16 iconic-icon-check-alt white', opacity: 0.95, hide: true, history: false, sticker: false }); } }); }); }); });