<Button id="createButton" icon="sap-icon://add" tooltip="Create" visible="true" press="onOpenAddDialog">
<dependents>
<Dialog id="OpenDialog" title="Create Sales Order">
<buttons>
<Button id="confirmCreate" text="Create" press=".onCreate" type="Emphasized" />
<Button id="cancelCreate" text="Cancel" press="onCancelDialog" type="Transparent" />
</buttons>
<form:SimpleForm editable="true" layout="ResponsiveGridLayout">
<form:content>
<Label text="SO Number" required="true" />
<Input id="idSo" change="onNameChange" />
<Label text="Customer Name" />
<Input id="idCustName" rows="4" />
<Label text="Customer Number" />
<Input id="idCustomer" rows="4" />
<Label text="Po Number" />
<Input id="idPo" rows="4" />
<Label text="Inquiry Number" />
<Input id="idInqNumber" rows="4" />
</form:content>
</form:SimpleForm>
</Dialog>
</dependents>
onOpenAddDialog: function () {
this.getView().byId("OpenDialog").open();
},
onCancelDialog: function (oEvent) {
oEvent.getSource().getParent().close();
},
onCreate: function () {
var oSo = this.getView().byId("idSo").getValue();
if (oSo !== "") {
const oList = this._oTable;
const oBinding = oList.getBinding("items");
const oContext = oBinding.create({
"soNumber": this.byId("idSo").getValue(),
"customerName": this.byId("idCustName").getValue(),
"customerNumber": this.byId("idCustomer").getValue(),
"PoNumber": this.byId("idPo").getValue(),
"inquiryNumber": this.byId("idInqNumber").getValue()
});
oContext.created()
.then(()=>{
// that._focusItem(oList, oContext);
this.getView().byId("OpenDialog").close();
});
}else {
MessageToast.show("So cannot be blank");
}
},
this._oTable = this.byId("table0");
"sap/m/MessageToast",
function (Controller, MessageToast)
<Button id="deleteButton" icon="sap-icon://delete" tooltip="Delete" visible="false" press="onDelete">
<Button id="editModeButton" visible="true" icon="sap-icon://edit" tooltip="Edit" press="onEditMode">
onEditMode: function(){
this.byId("editModeButton").setVisible(false);
this.byId("saveButton").setVisible(true);
this.byId("deleteButton").setVisible(true);
this.rebindTable(this.oEditableTemplate, "Edit");
}
onDelete: function(){
var oSelected = this.byId("table0").getSelectedItem();
if(oSelected){
var oSalesOrder = oSelected.getBindingContext("mainModel").getObject().soNumber;
oSelected.getBindingContext("mainModel").delete("$auto").then(function () {
MessageToast.show(oSalesOrder + " SuccessFully Deleted");
}.bind(this), function (oError) {
MessageToast.show("Deletion Error: ",oError);
});
} else {
MessageToast.show("Please Select a Row to Delete");
}
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
10 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
2 | |
2 |