Question

I am running into a strange problem with not being able to update properties on an object that is returned as part of a deferred promise.

// Update or Insert status information into the idr_status table
this.updateStatus = function (idrInspData, statusId, submitting)
{
    var def = new $.Deferred();
    self.getIdrStatus (idrInspData.idr_date).done (function (idrStatus)
    {
        //status record exists for the day update record
        idrStatus.status_msg_id = statusId;
        idrStatus.submitted = submitting ? 1 : 0;
        idrStatus.modified = 1;

        idrStatus.action_needed = statusId.search('+') != -1 ? true : false;

        // update the status
        self.db.updateRecord (self.idrStatusTableName, idrStatus).always (
            function (updateResult)
            {
                def.resolve(true);
            });

    }).fail (function (result)
    {
       def.reject(result);
    });

    return (def.promise ());
}

The idrStatus object is returned from a SQLite resultset and then converted to a plain JS object then resolved to the done function above. The object comes in but any attempt to edit the properties are simply ignored and the same object is passed Unchanged to the updateRecord function. I am puzzled? Why would the object be locked?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top