Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Merging cells in runtime
Reji
Hi,
Is there any way to merge table cells during run time?
Here is my table and based on some condition i need to merge some of the cells in the row (as shown in 2nd and 4th rows). (pls see attachment)
where should i put the code for doing this? If I put logs in Row's 'oncreate' and each cells 'oncreate', from the log i can see that both are called alternatively.
I am using 2.3.1.
Any help is appreciated.
Regards,
Reji
Find more posts tagged with
Comments
mwilliams
Hi Reji,
I've got a few questions for you. What is the reason for merging these cells? What does your data look like? How do you know whether to merge or not? What will the table look like with data in it with these cells merged?
Reji
Hi,
Thank you for your reply.
Infact I skipped the details to avoid complexity. Any way here it's..
In the last column there'll be some descriptive data as shown in the initial.gif.
Now in the onrenderer I can split it (using new line character) and get 'n' items. i am able to distribute these items in the same row's columns as shown in the current.gif. This much is working fine.
Now I need to merge each 3 or 4 cells of the first 10 cells, and then put the data in each 3 merged, wider cells. It wold look some thing like in final.gif.
Hope it's clear.
Thanks and Regards,
Reji
mwilliams
Reji,<br />
<br />
You should be able to use code like the following in the beforeFactory script of your report:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
table = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Table1");
dtl = table.getDetail( ).get( 0 );
cell1 = dtl.getCells( ).get( 0 );
cell2 = dtl.getCells( ).get( 1 );
cell2.drop( );
cell1.setColumnSpan( 2 );
</pre>
<br />
Let me know if this works for you.
Reji
Dear Michael,
Thank you for your reply.
This is some thing what I am looking for.
But, I need to merge cells based on values in some columns FOR EACH ROW.
If I am doing this in 'beforefactory', it will not be possible, right?
Is it possible to do this in each rows 'oncreate' or some other method, so that i can access the column values in CURRENT ROW and decide whether to merge cells or not?
In the mean time let me try out your suggestion and see if it works.
Thanks and Best Regards,
Reji