Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Deleting via SPServices

$
0
0

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


Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>