cancel
Showing results for 
Search instead for 
Did you mean: 

sap.m.table merge cells

SergioG_TX
Active Contributor
0 Kudos

All,

I have a table in the mobile framework (sap.m.table) and it is working great. I am using the mergeDuplicates property on one of the columns and it is also working as expected. One thing I want to know if it is possible and maybe guidance to documentation or examples .. my merged cell is working fine ( I don't see repeated rows), however my merge cell is more than a couple rows long. how can I make it rowSpan > 1 so that my merge cell takes n number of rows and my cells > (mergedCell) is only 1 row height each... currently, my first row has the height of my merge cells. ideally I would like my merge cell to take as many rows as it needs.. but the cols >2 to be only 1 row height

it seems like my merge cells in the column is working but my rows aren't. any ideas / tips are appreciated.

thank you in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

When you set mergeDuplicates to true on an sap.m.Column, it sets a class (sapMLIstTblCellDup) on all <td> tags, except for the first targeted <td>, within that column.  The class simply styles those <td> tags to look like a row span.  In order to get your scenario to work, you have to use jQuery to remove all the other <td> tags in that column as well as set to rowspan on the targeted <td> to the length of rows that have duplicated value. 

On this example, i know that my rowspan will always be 8.  To make it 100% dynamic, you will need to find how many rows the duplication lasts for.  I also added a class (mtrlAttrs) to the targeted <td> tag so i can find it with jQuery.

You will need to call this function after your table is rendered and also on the updateFinished event of the sap.m.Table if you have growing enabled.

SergioG_TX
Active Contributor
0 Kudos

Mr. Nate Marks,

this is exactly what I needed. Thank you very much for your help.

I am marking it as correct and closing it.

Answers (1)

Answers (1)

SergioG_TX
Active Contributor
0 Kudos

I think I can answer myself here.. If I increase the width of my merge cell this solves my issue.

hope others can benefit from it. I knew it was a simple thing

agentry_src
Active Contributor
0 Kudos

Please mark this Discussion with a Correct Answer and Helpful Answer where appropriate.  See http://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why   Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be.

Regards, Mike (Moderator)
SAP P&I Technology RIG

SergioG_TX
Active Contributor
0 Kudos

I did mark this helpful.. but I am still not 100% correct that's what I really need. Increasing the width of the cell makes the row smaller.. but I still would like to see if I can make this cell rowspan > 1