Deleting via SPServices

Jan 3, 2013 at 8:12 AM

Hi Marc

while deleting list items via sp services using

/* $().SPServices.SPUpdateMultipleListItems({
      listName: "xxxxx",
      CAMLQuery: "<Query><Where><And><Eq><FieldRef Name='UserEmail' /><Value Type='Text'>"+User+"</Value></Eq><Eq><FieldRef Name='UserGroup' /><Value Type='Lookup'>"+grp+"</Value></Eq></And></Where></Query>",
      batchCmd: "Delete",
      async:true,
      debug: false,
      completefunc: function(xData, Status) {
                  
                  }
    });   
   });*/

and then comparing it with the old way of doing it

$().SPServices({
             operation: "GetListItems",
             async: true,
             debug: true,
             listName: "UserPermissions",
             CAMLViewFields: "<ViewFields><FieldRef Name='ID' /></ViewFields>",
             CAMLQuery: "<Query><Where><And><Eq><FieldRef Name='UserEmail' /><Value Type='Text'>"+User+"</Value></Eq><Eq><FieldRef Name='UserGroup' /><Value Type='Lookup'>"+grp+"</Value></Eq></And></Where></Query>",
             completefunc: function (xData, Status) {
                   $(xData.responseXML).find("[nodeName=z:row]").each(function () {
                       $().SPServices({
                           operation: "UpdateListItems",
                           async: true,
                           debug: true,
                           batchCmd: "Delete",
                           listName: "UserPermissions",
                           ID: $(this).attr("ows_ID"),
                           completefunc: function (xData, Status) {
                              
                           }
                       });
                   });
               }
           });
       });
  

I realized that the later was faster than the new SPUpdateMultipleListItems''.reason i say this is because, i had an 'ajax loding image' which was fired on 'click' and in the later case it showed up
instantly, wheras while doing it via 'SPUpdateMultipleListItems' it took a delay of 2 seconds.

Am i correct or just doing it the wrong way ?

Thanks

Rajat