如何在shell统一Sapui5中绑定用户名

如何在shell统一Sapui5中绑定用户名,sapui5,Sapui5,我想将odata服务中的用户名绑定到shell fragement视图中的用户名 这是我的密码 <core:FragmentDefinition class="viewPadding"> <u:Shell icon="./images/sap-logo.png" id="myShell"> <u:headItems> <u:ShellHeadItem

我想将odata服务中的用户名绑定到shell fragement视图中的用户名 这是我的密码

<core:FragmentDefinition

class="viewPadding">
<u:Shell
  icon="./images/sap-logo.png"
        id="myShell">
        <u:headItems>            
            <u:ShellHeadItem
                tooltip="Home"
                icon="sap-icon://home"
                visible="false"
                press="handlePressHome" />
        </u:headItems>

        <u:user>
            <u:ShellHeadUserItem
                image="sap-icon://person-placeholder"
                username="{UserCo}"
                press="handleUserItemPressed" />
        </u:user>

    </u:Shell> 

    </core:FragmentDefinition>

还有odata服务

<EntityType Name="USERCO" sap:content-version="1">
   <Key>
     <PropertyRef Name="UserCo"/>
  </Key>
  <Property Name="UserCo" Type="Edm.String" Nullable="false" MaxLength="30"        sap:sortable="false" sap:filterable="false"/>
  </EntityType>


任何想法请参见步骤1:使用setModel()在组件或片段的父视图上设置模型

步骤2:接下来,在实例化片段的代码中,使用addDependent()方法将片段作为依赖项添加到父视图(设置模型的视图)中

<Parent View Reference>.addDependent(<fragment instance>);
.addDependent();
步骤3:然后确保片段中的绑定是正确的

步骤4:测试

步骤5(调试):如果仍然不工作,启动应用程序并检查绑定是否正确(可能缺少斜杠等)。为此,您可以使用SAPUI5诊断。按Alt-Ctrl-Shift-S。在弹出的选择控制树中,导航到绑定元素“u:ShellHeadUserItem”。选择它并检查“绑定信息”标签