0

I want to display 30 list items on a page. On checkbox change event I want to delete items from a SharePoint list.

I can do this using spgridview server side , but how can this be done client side (csom)?

1 Answer 1

1

you can try full rest api and JQuery.

Attach a change listener using jquery to your controls and on that listener you can use the next code

$.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('your_list')/items(your_id)",
    type: "POST",
    contentType: "application/json;odata=verbose",
    headers: {
        "IF-MATCH": "*",
        "Accept": "application/json;odata=verbose",
        "X-RequestDigest":     $("#__REQUESTDIGEST").val(),
       "X-HTTP-Method": "DELETE"
    },
    success: function (data) {
         console.log(data);
    },
    error: function (data) {
        console.log(data);
    },
    complete: function (data) {
        console.log(data);
    }
});

happy coding :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.