Skip to content

Deleting Records

EntitySpaces edited this page Jan 26, 2012 · 3 revisions
    // Load a single employee and delete it
    var emp = new es.objects.Employees();
    emp.loadByPrimaryKey(employeeId);
    emp.markAsDeleted();
    emp.save();

    // Load a collection an delete a few employees
    var coll = new es.objects.EmployeesCollection();
    coll.loadAll();
    coll.markAsDeleted(coll()[4], coll()[5], coll()[6]); // 4th, 5th, and 6th item
    coll.save();

    // Load a collection an delete a few employees passing them in as an array
    var coll = new es.objects.EmployeesCollection();
    coll.loadAll();
    
    var arr = [];
    arr.push(coll()[4]);
    arr.push(coll()[5]);
    arr.push(coll()[6]);

    coll.markAsDeleted(arr);
    coll.save();

Clone this wiki locally