Skip to Content
0

Using sap.ui.table.RowActionItem in XML views.

Jul 12, 2017 at 07:23 AM

583

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Nicholas Owen O’Malley Mar 05 at 07:00 AM
1

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 }
Show 1 Share
10 |10000 characters needed characters left characters exceeded

This is a bit late but thank you for the example. I ended up doing the same after reading the original answer.

0
VIPLOVE KHUSHALANI Jul 12, 2017 at 10:13 AM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded

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

This seems to work for me, Thank you Viplove!

<table:rowActionTemplate>
	<table:RowAction>
               <table:RowActionItem press="onSelectPriceGroup"				type="Navigation" icon="sap-icon://feeder-arrow" />
	</table:RowAction>
</table:rowActionTemplate>
0