Bind SmartTable with entityset (of an entity)

后端 未结 2 1269
时光说笑
时光说笑 2021-01-07 08:16

I\'ve got a question regarding the binding of a sap.ui.comp.smarttable.SmartTable.

I have two Entities and thereby also two Entitysets, A and B.

A has 1-to-n r

相关标签:
2条回答
  • 2021-01-07 08:32

    Since there is no code i will try my best to answer this . You need to bind A('7')/B .
    For this the smart table's EntitySet=B(based on this the Smart Table will build the columns for you).
    TableBindingPath should be name of the navigation property from A to B.
    But for this work you should have set the model on the View which has Smart Table. Otherwise there will no data on the table.

    Now there are 1 more property in smart table .
    1. enableAutoBinding - If this is set to true then the smart table will automatically bind the data to the table.
    2. If it is set to false you will need to call explicitly the method rebindTable on the Smart Table

    A sample code snippet is shown below
    SmartTable id="SmartTable" entitySet = "POItems" tableType="ResponsiveTable" enableAutoBinding="true" editable = "true" tableBindingPath="Items"

    Here POItems is the name of the entity in service. Items is the name of the association from POHeaders (===> A from your example) to POItems(=====> B from your example)

    Hope this helps.

    Cheers, Veera

    0 讨论(0)
  • 2021-01-07 08:34

    In xml view you can do it with tableBindingPath simply like this:

    <smarttable:SmartTable enableAutoBinding="true"  entitySet="B" tableBindingPath="/A('7')/C" ...
    

    Where C is the name of the navigation property. Check that it is not "A('7')/C" or "/A/7/C"!

    Dynamically you can do with with setTableBindingPath method i.e:

    var id = "7";
    this.getView().byId('smartTable').setTableBindingPath("/A('" + id + "')/C");
    

    Moreover I didn't have to rebindTable.

    0 讨论(0)
提交回复
热议问题