Skip to Content

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 05 at 07:00 AM

    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 }
    Add comment
    10|10000 characters needed characters exceeded

  • Jul 12, 2017 at 10:13 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

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