Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ravindra Booyi on Jan 20, 2009 06:02
open dhtmlx forum
Delete multiple rows

function removeRow(){
           
            var selId = mygrid.getSelectedId()
            if(!selId)
            {
            alert("Select row for deletion!!");
            return ;
            }
            
            var answer = confirm("Are you sure you want to delete row?");
           if (answer)
        {
        mygrid.deleteRow(selId);
           var cid    = document.getElementById("cname").value;
       
           jQuery.ajax({
             url    :"/adtvworld/viewCampaign",
             type   :"POST",
             data   :{action:"deleteRow",selId:selId,cid:cid},
             success:function(){
                  jQuery("#rmStatus").fadeIn("50").text("Video Removed !!..").fadeOut(9000);

             }
         });
          }
    }
This function will delete one row at a time.. i need to delete multiple rows select and delete..
Thanks and Regards
Ravindra B
Answer posted by Support on Jan 20, 2009 08:30
In case of multi-selection in grid ( enableMultiselect ) , getSelectedId returns not a single ID but comma separated list, so you can split at and execute deleteRow for necessary IDs

Also, there is a built in method deleteSelectedRows - which will delete all currently selected rows.