简体   繁体   English

SAPUI5:如何绑定智能表

[英]SAPUI5: How to Bind smart table

Hi i have a smart table like below 嗨,我有一个像下面的智能表

<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>

my odata service is like below: 我的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>

my smart table is there in second view which is has a navigation from the first view. 我的智能表位于第二个视图中,该视图具有从第一个视图开始的导航。 when ever i move to the second view we are binding the total view with a different path like below. 每当我移至第二个视图时,我们都将总视图绑定到如下所示的不同路径。

  this.getView().bindElement(bindingPath);

bindingPath = "/Collections('12345')" bindingPath =“ / Collections('12345')”

here in my case, i am trying to bind the path "Employee", which is a parent navigation at root level. 在我的情况下,我试图绑定路径“ Employee”,这是根级别的父级导航。

iam confused about entitySet and tableBindingPath 我对EntitySettableBindingPath感到困惑

metadata of oData is as follows. 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>

my DB table is as follows:- 我的数据库表如下:

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;
}; 

my odata is as follows. 我的odata如下。

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

i confused about the mapping here. 我对这里的映射感到困惑。 what does the entitySet expects, is it table name or entityType name in metadata and what about the table binding path. 实体集期望什么,它是元数据中的表名还是实体类型名,以及表绑定路径如何。 Can any body answere this. 任何人都可以回答这个问题。


The entitySet expects the name of your Entity in Service. entitySet需要服务中的实体名称。 This is mainly required so that in the settings button all the fields in your entity will come up. 这主要是必需的,以便在设置按钮中显示您实体中的所有字段。
TableBindingPath - this is to bind the data. TableBindingPath-这是绑定数据。 For example you could be binding the table to association to a Parent in which case you specify the association name. 例如,您可以将表绑定以将关联关联到父级,在这种情况下,您可以指定关联名称。
This Reference should probably help. 参考可能会有所帮助。

Kindly note, if you do not specify the tableBindingPath and set the enableAutoBinding flag to true then system will table will automatically call getEntitySet on entitySet specified. 请注意,如果您未指定tableBindingPath且将enableAutoBinding标志设置为true,则系统表将在指定的entitySet上自动调用getEntitySet。
Hope this helps. 希望这可以帮助。
Thanks and Regards, 谢谢并恭祝安康,
Veera 维拉

I found the below regarding SmartTable. 我发现以下有关SmartTable的内容。

Check the version of the sapui5 you are using, in my case i am using sapui5 1.28.5, in which smart table is not working, then i changed the version of the sapui5 to 1.30 it started working. 检查您正在使用的sapui5的版本,在我的情况下,我正在使用sapui5 1.28.5,在该表中智能表不起作用,然后我将sapui5的版本更改为1.30,它开始起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM