Image as delete button

Image as delete button

DarkPrince2005DarkPrince2005 Posts: 2Questions: 0Answers: 0
edited January 2013 in DataTables 1.9
Hi everyone, I'm very new to DataTables. I've played around a bit but i can't seem to get the delete image i append to each row to do a delete server-side.

[code]$('#example tbody tr a.delete').live('click',function(event){
var iPos = oTable.fnGetPosition(event.target.parentNode);
var aData = oTable.fnGetData(iPos);
var iId = aData[0];
var values = aData[0];
if ( confirm( "Are you sure you want to delete the selected rows?" ) )
$.ajax({
url: "includes/delete.php",
type: "post",
data: {cid:aData[0]},
success: function(){
if ($("#example").length > 0 && oTable)
{
oTable.fnDraw(true);
}
alert("Record successfully deleted.");

},
error:function(){
alert("failure");
$("#result").html('there is error while submit');
}
});
});[/code]

Replies

  • DarkPrince2005DarkPrince2005 Posts: 2Questions: 0Answers: 0
    [code]oTable = $('#example').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "includes/clients_processing.php",
    "fnDrawCallback": function()
    {
    $("#example thead tr").append("");
    $("#example thead tr").append("");
    $(".even").append("");
    $(".even").append("");
    $(".odd").append("");
    $(".odd").append("");
    $("#example tfoot tr").append("");
    $("#example tfoot tr").append("");
    }
    });[/code]
This discussion has been closed.