<mvc:View
controllerName="sap.ui.demo.wt.Detail"
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc">
<Page title="Territory Details" showNavButton="true" navButtonPress="onBack">
<content>
<Button press="onPress" text="Update" />
<Table id="idProductsTable" items="{view>Territories}" mode="SingleSelectMaster">
<columns>
<Column>
<Label text="TerritoryID" />
</Column>
<Column>
<Label text="TerritoryDescription" />
</Column>
<Column>
<Label text="RegionID" />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text= "{view>TerritoryID}" />
<Text text= "{view>TerritoryDescription}" />
<Text text= "{view>RegionID}" />
</cells>
</ColumnListItem>
</items>
</Table>
</content>
</Page>
</mvc:View>
onPress: function(){
var oView = this.getView();
var oDialog = oView.byId("dlgUpdate");
// create dialog lazily
if (!oDialog) {
oDialog = sap.ui.xmlfragment(oView.getId(), "sap.ui.demo.wt.update", this);
oView.addDependent(oDialog);
}
oDialog.open();
},
onPress: function(){
var oView = this.getView();
var oDialog = oView.byId("dlgUpdate");
// create dialog lazily
if (!oDialog) {
oDialog = sap.ui.xmlfragment(oView.getId(), "sap.ui.demo.wt.update", this);
oView.addDependent(oDialog);
}
oDialog.bindElement({
path: this.byId("idProductsTable").getSelectedItem().getBindingContext("view").getPath(),
model: "view"
});
oDialog.open();
},
<core:FragmentDefinition xmlns:layout="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core" xmlns="sap.m">
<Dialog id="dlgUpdate" title="Update Vaccination">
<content>
<f:SimpleForm editable="false" layout="ResponsiveGridLayout" labelSpanXL="4" labelSpanL="3" labelSpanM="4" labelSpanS="12"
adjustLabelSpan="false" emptySpanXL="0" emptySpanL="4" emptySpanM="0" emptySpanS="0" columnsXL="2" columnsL="1" columnsM="1"
singleContainerFullSize="false">
<f:content>
<Label text="Territory" />
<Input value="{view>TerritoryID}"/>
<Label text="TerritoryDescription" required="true" />
<Input value="{view>TerritoryDescription}" />
<Label text="RegionID" required="true" />
<Input value="{view>RegionID}" />
</f:content>
</f:SimpleForm>
</content>
<buttons>
<Button text="Update" press="onUpdate"
/>
<Button text="Cancel" press="onCancelUpdate"/>
</buttons>
</Dialog>
</core:FragmentDefinition>
/**
* Closes the update PosReq dialog
* @returns {void}
*/
onCancelUpdate: function () {
const oDialog = this.byId("dlgUpdate");
if (this.getView().getModel("view").hasPendingChanges()) {
this.getView().getModel("view").resetChanges([oDialog.getBindingContext("view").getPath()]); }
oDialog.close();
},
onUpdate: function(){
this.getView().getModel("view").submitChanges();
this.onCancelUpdate();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |