{"action":"opened","issue":{"url":"https://api.github.com/repos/DroopyTersen/spscript/issues/15","labels_url":"https://api.github.com/repos/DroopyTersen/spscript/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/DroopyTersen/spscript/issues/15/comments","events_url":"https://api.github.com/repos/DroopyTersen/spscript/issues/15/events","html_url":"https://github.com/DroopyTersen/spscript/issues/15","id":60149384,"number":15,"title":"Include Delete Item in List Actions","user":{"login":"wegnes00","id":10761139,"avatar_url":"https://avatars.githubusercontent.com/u/10761139?v=3","gravatar_id":"","url":"https://api.github.com/users/wegnes00","html_url":"https://github.com/wegnes00","followers_url":"https://api.github.com/users/wegnes00/followers","following_url":"https://api.github.com/users/wegnes00/following{/other_user}","gists_url":"https://api.github.com/users/wegnes00/gists{/gist_id}","starred_url":"https://api.github.com/users/wegnes00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wegnes00/subscriptions","organizations_url":"https://api.github.com/users/wegnes00/orgs","repos_url":"https://api.github.com/users/wegnes00/repos","events_url":"https://api.github.com/users/wegnes00/events{/privacy}","received_events_url":"https://api.github.com/users/wegnes00/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-06T19:48:02Z","updated_at":"2015-03-06T19:48:02Z","closed_at":null,"body":"deleteItem: function (itemId) {\r\n\t\t\t    var url = baseUrl + \"/items(\" + itemId + \")\";\r\n\t\t\t    return self.get(url).then(function (data) {\r\n\t\t\t        var item = data.d;\r\n\t\t\t        var postBody = \"\";\r\n\t\t\t        var customOptions = {\r\n\t\t\t            headers: {\r\n\t\t\t                \"Accept\": \"application/json;odata=verbose\",\r\n\t\t\t                \"X-RequestDigest\": $(\"#__REQUESTDIGEST\").val(),\r\n\t\t\t                \"X-HTTP-Method\": \"DELETE\",\r\n\t\t\t                \"If-Match\": item.__metadata.etag\r\n\t\t\t            }\r\n\t\t\t        }\r\n\t\t\t        return self.post(url, postBody, customOptions);\r\n\t\t\t    });\r\n\t\t\t},\r\n\t\t\tdeleteAll: function () {\r\n\t\t\t    var self = this;\r\n\t\t\t    var odata = null;\r\n\t\t\t    return getItems(odata).then(function (items) {\r\n\t\t\t        if (items && items.length && items.length > 0) {\r\n\t\t\t            for (i = 0; i < items.length; i++) {\r\n\t\t\t                self.deleteItem(items[i].Id);\r\n\t\t\t            }\r\n\t\t\t        }\r\n\t\t\t    });\r\n\t\t\t}\r\n\r\n\r\nExample Use:\r\n<script type=\"text/javascript\">\r\n$(document).ready(function () {\r\n\r\n\r\n    $('#DeleteItems').click(function () {\r\n        alert(\"Deleting..\");\r\n        var siteUrl = _spPageContextInfo.webAbsoluteUrl;\r\n        var listSvc = new SPScript.RestDao(siteUrl);\r\n        var listItemId = $('#ListItemIds').val();\r\n        var listName = \"Warranty Pictures\";\r\n\r\n        var deleteListItemRequest = listSvc.lists(listName).deleteItem(listItemId);\r\n    });\r\n});\r\n</script>\r\n\r\n<div> \r\n   <input name=\"ListItemIds\" id=\"ListItemIds\" type=\"text\"/>\r\n   <br/>\r\n   <input id=\"DeleteItems\" type=\"button\" value=\"Delete Items\"/> \r\n​​​</div>\r\n"}}