SAPUI5:如何绑定智能表

时间:2015-08-18 09:10:15

标签: javascript jquery sapui5

嗨我有一个如下的智能表

<VBox id="myid">
        <smartTable:SmartTable id="smartTable_ResponsiveTable" entitySet = "Employee" enableAutoBinding="true"
                tableType="ResponsiveTable" initialise="onSmartTableInit" editable="false" useVariantManagement="false"
                useTablePersonalisation="true" header="Employees" showRowCount="true" useExportToExcel="true" />
</VBox>

我的odata服务如下:

<workspace>
  <atom:title>Default</atom:title>
  <collection href="TablePersonalization">
      <atom:title>TablePersonalization</atom:title>
  </collection>
  <collection href="Employee">
     <atom:title>Employee</atom:title>
  </collection>
  <collection href="Collections">
    <atom:title>Collections</atom:title>
  </collection>
</workspace>

我的智能表位于第二个视图中,该视图具有第一个视图的导航。当我移动到第二个视图时,我们将整个视图绑定到不同的路径,如下所示。

  this.getView().bindElement(bindingPath);

bindingPath =“/ Collections('12345')”

在我的情况下,我试图绑定路径“Employee”,这是根级别的父导航。

我对 entitySet tableBindingPath

感到困惑

oData的元数据如下。

<EntityType Name="EmployeeType">
 <Key>
  <PropertyRef Name="EMP_ID"/>
 </Key>
 <Property Name="EMP_ID" Type="Edm.String" Nullable="false"   MaxLength="1024"/>
 <Property Name="NAME" Type="Edm.String" Nullable="false" MaxLength="1024"/>
 <Property Name="ADDR" Type="Edm.String" Nullable="false" MaxLength="1024"/>
 <Property Name="SAL" Type="Edm.String" Nullable="false" MaxLength="1024"/>
</EntityType>

我的数据库表格如下: -

entity Employee {
    key EMP_ID      :               String(1024) not null;  // Identifier of   the Column
    NAME            :               String(1024) not null;
    ADDR            :               String(1024) not null;
    SAL             :               String(1024) not null;
}; 

我的odata如下。

"MY_SCHEMA"."my.db.models::CollectionModel.Employee" as "Employee";

我对此处的映射感到困惑。 entitySet需要什么,是元数据中的表名或实体类型名称,以及表绑定路径。 任何机构都可以回答这个问题。

2 个答案:

答案 0 :(得分:1)


      entitySet 需要您的实体在服务中的名称。这主要是必需的,以便在设置按钮中实体中的所有字段都会出现       TableBindingPath - 这是绑定数据。例如,您可以将表绑定到与Parent的关联,在这种情况下,您可以指定关联名称 这Reference 应该有所帮助。

请注意,如果您未指定tableBindingPath并将enableAutoBinding标志设置为true,那么系统将表将自动调用指定的entitySet上的getEntitySet。
希望这可以帮助。
谢谢和问候,
威拉

答案 1 :(得分:0)

我在SmartTable上找到了以下内容。

检查你正在使用的sapui5的版本,在我的情况下,我使用sapui5 1.28.5,其中智能表不起作用,然后我将sapui5的版本更改为1.30它开始工作。

相关问题