Mahendra Kulkarni
Mahendra Kulkarni

Reputation: 1507

How to show two Buttons in single column in SAPUI5

I have a Table with four column, in the last column I want to have two buttons in each row.

I have tried using static code in XML, but it's not working:

<Table id="tableid">
  <columns>
    <Column>
      <Text text="Product" />
    </Column>
    <Column>
      <Text text="Price" />
    </Column>
    <Column>
      <Text text="compant" />
    </Column>
    <Column>
      <Text text="Buttons" />
    </Column>
  </columns>
</Table>
<items>
  <ColumnListItem>  
    <cells>  
      <Text text="TV"/>  
    </cells>  
    <cells>  
      <Text text="15000"/>  
    </cells>
    <cells>  
      <Text text="samsung"/>  
    </cells>   
    <cells>  
      <Button text="Button1"/>
      <Button text="Button2"/>
    </cells> 
  </ColumnListItem>  
</items>

Upvotes: 3

Views: 6568

Answers (2)

Gustavo Fontinha
Gustavo Fontinha

Reputation: 59

I had the same need. I share a peace of my code, I include tooltip and didn't use texts in buttons:

    <columns>
        <Column>
            <header>
                <Text text="ID" />
            </header>
        </Column>
        <Column>
            <header>
                <Text text="Name" />
            </header>
        </Column>
        <Column>
            <header>
                <Text text="Actions" />
            </header>
        </Column>
    </columns>
    <ColumnListItem>
        <Text text="{CustomerID}" />
        <Text text="{ContactName}" />
        <cells>
            <HBox>
                <Button icon="sap-icon://detail-view" type="Transparent" tooltip="View" press="onPressViewXXX"/>
                <Button icon="sap-icon://begin" type="Transparent" tooltip="Reproc" press="onPressReprocXXX"/>
                <Button icon="sap-icon://decline" type="Transparent" tooltip="Cancel" press="onPressCancelXXX"/>
            </HBox>
        </cells>
    </ColumnListItem>
</Table>

Upvotes: 0

Ashish Patil
Ashish Patil

Reputation: 1742

You can use HBox control to get two buttons in single cell.

Here I have created jsbin for it.

Upvotes: 5

Related Questions