Monday, 24 January 2022

element binding sap.ui.table

 View

<mvc:View
    controllerName="projecteb.controller.View1"
    xmlns:ui="sap.ui.table"
    xmlns:mvc="sap.ui.core.mvc"
    displayBlock="true"
    xmlns="sap.m"
         
    xmlns:f="sap.ui.layout.form"
         
>
    <Shell id="shell">
        <App id="app">
            <pages>
                <Page id="page" title="{i18n>title}">
                    <content >
                  <ui:Table     rows="{/Customers}"  selectionMode="Single"   
 rowSelectionChange="onrowSelectionChange" >
                    <ui:columns>
                        <ui:Column width="11rem">
                        <Label text="CustomerID" />
                        <ui:template>
                            <Text text="{CustomerID}"   />
                        </ui:template>
                    </ui:Column>

                    <ui:Column width="11rem">
                        <Label text="CompanyName" />
                        <ui:template>
                            <Text text="{CompanyName}"   />
                        </ui:template>
                    </ui:Column>
                    <ui:Column width="11rem">
                        <Label text="ContactTitle" />
                        <ui:template>
                            <Text text="{ContactTitle}"   />
                        </ui:template>
                    </ui:Column>
                    <ui:Column width="11rem">
                        <Label text="ContactName" />
                        <ui:template>
                            <Text text="{ContactName}"   />
                        </ui:template>
                    </ui:Column>
                        </ui:columns>
                  </ui:Table>


                    <f:SimpleForm id="SimpleFormDisplay354"
            editable="true" >
            <f:content>
                <Label text="CustomerID" />
                <Input id="CustomerID" value="{CustomerID}" />
                <Label text="CompanyName" />
                <Input value="{CompanyName} " />
                <Label text="ContactTitle" />
                <Input value="{ContactTitle}  " />
                <Label text="ContactName" />
                <Input id="ContactName" value="{ContactName}" />
            </f:content>
        </f:SimpleForm>
                    </content >
                </Page>
            </pages>
        </App>
    </Shell>
</mvc:View>


Controller:

sap.ui.define([
    "sap/ui/core/mvc/Controller"
],
    /**
     * @param {typeof sap.ui.core.mvc.Controller} Controller
     */
    function (Controller) {
        "use strict";

        return Controller.extend("projecteb.controller.View1", {
            onInit: function () {},
            onrowSelectionChange: function (oEvent) {
              var oRow = oEvent.getParameter("rowContext");
              var sPath = oRow.getPath();
              var oFORM = this.getView().byId("SimpleFormDisplay354");
              oFORM.bindElement(sPath)
            }
        });
    });


or

 onInit: function () {},
            onrowSelectionChange: function (oEvent) {
            //   var oRow = oEvent.getParameter("rowContext");
            //   var sPath = oRow.getPath();
            //   var oFORM = this.getView().byId("SimpleFormDisplay354");
            //   oFORM.bindElement(sPath)
            var oRow = oEvent.getParameter("rowContext");
            var oFORM = this.getView().byId("SimpleFormDisplay354");
            oFORM.bindElement(oRow.sPath)
            }
        });
    });


No comments:

Post a Comment

test ganaral binding(testing )

  /home/user/projects/project1/webapp/model/record.json: {     "text" : "outer text" ,     "myrecorsd" : [    ...