Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Deleting Data Items

Deleting Data Items

The Backend Services JavaScript SDK has the ability to delete single item based on its ID, or batch delete of multiple items based on a filter.

Deleting a Single Item by ID

To delete a single item, pass its ID to the data.destroySingle() method.

var el = new Everlive('your-app-id');
var data = el.data('type-name');
data.destroySingle({ Id: 'item-id' },
    function(){
        alert('Item successfully deleted.');
    },
    function(error){
        alert(JSON.stringify(error));
    });

Deleting Multiple Items

Multiple items are typically deleted trough a filter but you can also omit it in which case you will be deleting all items in the specified content type. Instead of passing a plain object for filter, you can pass an instance of Everlive.Query.

Always double-check your filter expression and test it on a dummy copy of your data. This will help you avoid destroying the wrong items.

The following example deletes all items that contain a Author field valued "Sample Text". On success, the response contains the number of deleted items.

var el = new Everlive('your-app-id');
var data = el.data('type-name');
data.destroy({ 'Author': 'Sample Text' }, // filter
    function (data) {
        alert('Items successfully deleted.');
    },
    function(error){
        alert(JSON.stringify(error));
    });

See Also

Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.