Sapui5 将数据从日历行传输到文本框

Sapui5 将数据从日历行传输到文本框,sapui5,Sapui5,我正在使用PlanningCalendar应用程序显示员工日程安排 但我还需要的是,在我点击工人(例如“Carlos Pinho”)后,他的数据名和角色会出现在SimpleForm红色箭头的文本框中 控制器: XML: 提前感谢你的帮助 我使用了所选行的绑定上下文,并将其绑定到下面的表单,它成功了。 以下是工作代码和步骤: 将行选择事件添加到计划日历 <PlanningCalendar id="PC1" startDate="{path: '/startDate'}" rows="{pat

我正在使用PlanningCalendar应用程序显示员工日程安排

但我还需要的是,在我点击工人(例如“Carlos Pinho”)后,他的数据名和角色会出现在SimpleForm红色箭头的文本框中

控制器:

XML:

提前感谢你的帮助


我使用了所选行的绑定上下文,并将其绑定到下面的表单,它成功了。 以下是工作代码和步骤:

将行选择事件添加到计划日历

<PlanningCalendar id="PC1" startDate="{path: '/startDate'}" rows="{path: '/people'}" 
    appointmentsVisualization="Filled"
    appointmentSelect="handleAppointmentSelect" showEmptyIntervalHeaders="false" viewKey="One Month"
    rowSelectionChange="onRowSelection">
步骤3:在表单中绑定正确的属性:

    onRowSelection: function(oEvent) {
        var oForm = this.byId('SimpleFormDisplay354');
        var oBindingContext = oEvent.getSource().getSelectedRows()[0].getBindingContext();
        oForm.setBindingContext(oBindingContext);
    }
    <f:SimpleForm id="SimpleFormDisplay354" class="sapUiLargeMarginTop" width="auto" editable="false" layout="ResponsiveGridLayout"
        title="Informações do Colaborador" labelSpanXL="3" labelSpanL="3" labelSpanM="3" labelSpanS="12" adjustLabelSpan="false" emptySpanXL="4"
        emptySpanL="4" emptySpanM="4" emptySpanS="0" columnsXL="1" columnsL="1" columnsM="1" singleContainerFullSize="false">
        <f:content>
            <Label text="Nome" width="100%" design="Bold"/>
            <Text text="{name}" width="100%"/>
            <!--Depois ir buscar estes dados à BD-->
            <Label text="Role" width="100%" design="Bold"/>
            <Text text="{role}" width="100%"/>
            </f:content>
    </f:SimpleForm>

让我知道这是否对您有效。

很抱歉,我之前没有回答您,但我无法回答。我现在试一试,告诉你它是否管用真可惜我不能把票提高10倍:但你的答案绝对正确,对我帮助很大!再次感谢拉胡尔:@TheAndréGomes:欢迎:。很高兴我能帮忙
    onRowSelection: function(oEvent) {
        var oForm = this.byId('SimpleFormDisplay354');
        var oBindingContext = oEvent.getSource().getSelectedRows()[0].getBindingContext();
        oForm.setBindingContext(oBindingContext);
    }
    <f:SimpleForm id="SimpleFormDisplay354" class="sapUiLargeMarginTop" width="auto" editable="false" layout="ResponsiveGridLayout"
        title="Informações do Colaborador" labelSpanXL="3" labelSpanL="3" labelSpanM="3" labelSpanS="12" adjustLabelSpan="false" emptySpanXL="4"
        emptySpanL="4" emptySpanM="4" emptySpanS="0" columnsXL="1" columnsL="1" columnsM="1" singleContainerFullSize="false">
        <f:content>
            <Label text="Nome" width="100%" design="Bold"/>
            <Text text="{name}" width="100%"/>
            <!--Depois ir buscar estes dados à BD-->
            <Label text="Role" width="100%" design="Bold"/>
            <Text text="{role}" width="100%"/>
            </f:content>
    </f:SimpleForm>