Multi Select Row Delete

Multi Select Row Delete

AlagAlag Posts: 5Questions: 0Answers: 0
edited July 2012 in General
Hi All,

Is there Multi Select Row Delete option in datatables?

Thanks

Replies

  • arjun_adhikariarjun_adhikari Posts: 32Questions: 0Answers: 0
    hi Alag,
    there isnt a specific multi row select delete option but you can achieve it very simply by applying the following steps
    atleast that's what i did....

    first get the table tools plugin which has row multi select option then use the fngetSelected() method to get all the rows which has been selected
    since i am using server side scripting i send the id's of the rows which i have selected and delete them.


    ps. refer to the following post to use fngetSelected() method

    http://datatables.net/forums/discussion/6295/fndeleterow-error-k-is-undefined/p1

    Arjun
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    The technique that Arjun describes is the method Editor uses: http://editor.datatables.net/release/DataTables/extras/Editor/examples/index.html :-)

    Allan
  • AlagAlag Posts: 5Questions: 0Answers: 0
    Thanks Arjun & Allan for the quick reply..
    I am using a checkbox for deleting selected rows..
    So if u can suggest for the above would be great..

    Thanks
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    Just select the checked checkboxes as you would with any jQuery selector (or use DataTables' $ API method to have it work regardless of paging etc) and then delete the rows with an Ajax call and fnDeleteRow .

    Allan
  • AlagAlag Posts: 5Questions: 0Answers: 0
    Thanks Allan,

    i need not delete on click of checkbox.
    user selects the checkbox of row 2,5,8 then he clicks on delete to delete the records..

    Thanks in advance
  • AlagAlag Posts: 5Questions: 0Answers: 0
    hi arjun_adhikari

    i tried like what you said but i get
    "oTable.fnGetNodes is not a function" error.. could you help me..

    Thanks
  • arjun_adhikariarjun_adhikari Posts: 32Questions: 0Answers: 0
    edited July 2012
    hi Alag,
    following is how i have achieved my multi delete functionality

    [code]
    function fnGetSelected( oTableLocal )
    {
    var aReturn = new Array();
    var aRet="";
    var aTrs = oTableLocal.fnGetNodes();
    for ( var i=0 ; i
This discussion has been closed.