on 08-07-2020 11:59 AM
hi!
I have connected a smarttable via cds and odata and now I want to click on an entry in the smarttable so that a new view opens.
However, I do not know how to get the data.
I have found this here: https://answers.sap.com/questions/12946842/how-to-get-selected-item-from-a-smart-table-in-a-f.html
onButtonPress: function (oEvent) {
var oSource = oEvent.getSource();
var oContext = oSource.getParent().getParent().getTable().getSelectedContexts();
evt.getSource().getParent().getParent().getSelectedItems();
But I don't know where to use this code.
I still don't understand how I make a selection that opens a new view. How do I get the click on a cell and trigger something that opens a view?
Hi truckla,
First you need to enable row selection on the SmartTable.
To do that, configure the internal table inside the SmartTable as below (assuming that you have selected ResponsiveTable as tableType).
<smartTable:SmartTable ...>
<Table>
<ColumnListItem type="Navigation" press="onItemPress">
</ColumnListItem>
</Table>
</smartTable:SmartTable>
This enables the SmartTable to show a small arrow on the far right.
Second, implement onItemPress method to trigger navigation.
onItemPress: function (oEvent) {
var id = oEvent.getSource().getBindingContext().getProperty("ProductID");
this.getOwnerComponent().getRouter().navTo("Detail", {
id: id
});
}
You can find more information about Routing and Navigation in blow document.
https://openui5.hana.ondemand.com/topic/2366345a94f64ec1a80f9d9ce50a59ef
Regards,
Mio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.