on 07-12-2017 8:23 AM
Hi,
I'm trying to use the RowActionItem in my sap.ui.table in an XML view. I've gone through this example in the explored app which attaches this control to the table through the controller. - https://sapui5.hana.ondemand.com/explored.html#/sample/sap.ui.table.sample.RowAction/preview
This is what I've tried in my view:
<table:Column >
<table:template>
<table:RowAction>
<table:RowActionItem press="onPress" icon="sap-icon://feeder-arrow" />
</table:RowAction>
</table:template>
</table:Column>
I can't see the an icon or trigger the press event but I see the row action column at the end of my table but it seems to be empty.
Thank you
Hello Abdul Moh'd
Maby a bit late, but so litte code examples in this forum, so i will try do do my bit.
Like VIPLOVE KHUSHALANI said, the markup is wrong.
There are 2 things to this. First the markup. I have added a example of 2 colums under. The second thing is that you need to specify rowActionCount to be 1 or 2.
xmlns:t="sap.ui.table"
var oData = {
"person": [
{
"name": "Foo",
"age": 30
}
]
}
<t:Table width="100%" rows="{/person}" rowActionCount="1" class="sapUiTinyMarginBottom">
<t:columns>
<t:Column width="70%">
<Label text="Name"/>
<t:template>
<Text text="{name}"/>
</t:template>
</t:Column>
<t:Column width="30%">
<Label text="Age"/>
<t:template>
<Text text="{age}"/>
</t:template>
</t:Column>
</t:columns>
<!--Here comes the magic-->
<t:rowActionTemplate>
<t:RowAction>
<t:items>
<t:RowActionItem type="Delete" press="onAttachmentDeletePress"></t:RowActionItem>
</t:items>
</t:RowAction>
</t:rowActionTemplate>
</t:Table>
onAttachmentDeletePress: function(oEvent){
//Delete the row from event
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abdul Moh'd ,
You are doing it incorrect .. please check out sap.ui.table.table in SDK properly : https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.table.Table.html#constructor
As the rowAction control will be part of rowActionTemplate aggregation of the Table control but you are putting it inside template aggregation of the Column control which is incorrect. And also you need to change the default value (0) of rowActionCount property to 1 or 2 (max we can have 2 visible row action columns)
Thanks
Viplove
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Viplove,
I've tried this but I get sap/ui/table/rowActionTemplate not defined. I may be doing something wrong again, can you please provide an example? Thanks
<table:Column >
<table:rowActionTemplate>
<table:RowAction>
<table:RowActionItem press="onPress" icon="sap-icon://feeder-arrow" />
</table:RowAction>
</table:rowActionTemplate>
</table:Column>
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.