return defaults;
},
+ /*
+ The whole purpose here was to throw the popup in the appropriate scenario.
+ Now that's happening in enyo - childWorkspace - deleteItem.
+
destroy: function (options) {
var status = this.getParent().get("status"),
K = XM.SalesOrder,
}
this.notify(message, payload);
- },
+ }, */
isActive: function () {
return this.get("status") === XM.SalesOrder.OPEN_STATUS;
Delete the model of the selected item and remove it from the list
*/
deleteItem: function () {
- var that = this,
- model = that.getCollection().at(this.getModelIndex()),
+ var model = this.getCollection().at(this.getModelIndex()),
message = "_unsavedChanges".loc() + " " + "_saveYourWork?".loc(),
callback = function (response) {
- var answer = response.answer,
- destroyOptions = {};
- destroyOptions.success = function () {
- console.log("in deleteItem's destroy success");
- //ws.$.salesOrderLineItemBox.valueChanged()
- //this.doPrevious();
- /*
- this.getCollection().at(this.getModelIndex()).destroy();
- this.renderWorkspace();
- */
-
- };
-
- if (answer) {
- /** Seems to be, after the destroy, what would normally be handled inside the grid box
- to refresh and remove the model from the collection is not happening because we're
- still in the workspce. Try doPrevious() first.
- */
+ if (response.answer) {
this.getActive().doPrevious();
- model.destroy(destroyOptions);
+ model.on("statusChange", this.waterfall("onChildWorkspaceValueChange"));
+ model.destroy();
+ // Waterfall down event - handled by lineItem grid box's valueChange function which "refreshes" the list
+ //this.waterfall("onChildWorkspaceValueChange");
}
};
this.doNotify({
type: XM.Model.YES_NO_CANCEL,
message: "_deleteLine?".loc(),
- callback: callback,
- success: callback
+ callback: callback
});
- //this.renderWorkspace();
},
/**
Add a new model to the collection and bring up a blank editor to fill it in