cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member560141
Participant

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

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

Answers (1)

Answers (1)

former_member340030
Contributor

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

0 Kudos

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 Kudos

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>