Hyperlink event to delete row

Hyperlink event to delete row

bubuzzzbubuzzz Posts: 26Questions: 0Answers: 0
edited August 2011 in DataTables 1.8
Dear all,

I trying to make the delete hyperlink on each row on the datatable to dynamically delete a row on the table and post back to the server. The click event works very fine. However, the row is still there. The following code is what i have done so far

[code]
var giRedraw = false;

function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();

for ( var i=0 ; i

Replies

  • bubuzzzbubuzzz Posts: 26Questions: 0Answers: 0
    edited August 2011
    update: after fixing some syntax bug and sending correct variable, the line
    [code]var anSelected = $jq16.fn.fnGetSelected(this);[/code]

    can work now, however, oTable.fnDeleteRow(anSelected[0]) still cannot work
  • allanallan Posts: 48,301Questions: 1Answers: 6,970 Site admin
    Since you are using server-side processing, and fnDeleteRow knows nothing about your server-side environment, you need to make an Ajax call to the server for it to do the delete and then call fnDraw on the table for it to refresh with the new data set.

    Allan
  • bubuzzzbubuzzz Posts: 26Questions: 0Answers: 0
    awesome !! it working now :D. Thank so much ,mate
  • allanallan Posts: 48,301Questions: 1Answers: 6,970 Site admin
    No problem - good to hear you got it working. I'll add a note to the documentation for fnAddData, fnUpdate and fnDeleteRow to mention this.

    Allan
  • bsullivabsulliva Posts: 6Questions: 3Answers: 0

    I also have a server side implementation with a link to delete a row. I'm calling fnDraw() like you mentioned, but if I'm on page 2, then the grid just resets and goes back to page 1. Is there anyway to stay on the same page after calling fnDraw()?

This discussion has been closed.