1 function NewJobProposalDeleteJPByJP_NUMBER(_JP_NUMBER)
2 {
3 //delete exit jp items
4 var isSucceed = true;
5 var deleteUpdates = "<Batch OnError=\"Continue\" ListVersion=\"1\" ViewName=\"\">";
6 $().SPServices({
7 operation: "GetListItems",
8 async: false,
9 listName: "m_job_proposal",
10 CAMLQuery: "<Query><Where><Eq><FieldRef Name='LinkTitle'/><Value Type='string'>"+ _JP_NUMBER+"</Value></Eq></Where></Query>",
11 CAMLViewFields: "<ViewFields><FieldRef Name='LinkTitle'/><FieldRef Name='ID'/></ViewFields>",
12 completefunc: function (xData, Status) {
13 var methodID = 1;
14 $(xData.responseXML).find("[nodeName='z:row']").each(function() {
15 var _LinkTitleID= $(this).attr("ows_ID");
16 deleteUpdates += "<Method ID=\""+methodID +"\" Cmd=\"Delete\"><Field Name='ID'>"+_LinkTitleID+"</Field></Method>";
17 methodID ++;
18 });
19 deleteUpdates += "</Batch>";
20 }
21 });
22 $().SPServices({
23 operation: "UpdateListItems",
24 async: false,
25 listName: "m_job_proposal",
26 updates: deleteUpdates,
27 completefunc: function(xData, Status) {
28 if(Status != "success")
29 {
30 isSucceed = false;
31 }
32 }
33 });
34 return isSucceed;
35
36 }