logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
dino_l  
#1 Posted : Wednesday, March 8, 2017 12:27:27 PM(UTC)
dino_l

Rank: Newbie

Groups: Registered
Joined: 3/8/2017(UTC)
Posts: 2
China

Thanks: 1 times
Hi Guys,
I have a requirement when I using Sealreport, I am not sure how to deal with it.
The question:
In the content table, if the first column content values are same as in different rows, it's consider to merge them in column cell.

for example,
Code:

first column| second column| column column
cell0       | cell 1       |  cell   2
cell0       | cell 3       |  cell   4


Because the values are same in first column, so merge first and second rows content as one cell, it becomes as follow

Code:

first column| second column|  third column
 cell0      | cell 1       |  cell   2
(merge here)| cell 3       |  cell   4


because the value in cell 0 is same, so merge them in a cell.

I have researched some examples in sealreport, but I was not able to find the same case.
my idea is that, to customize the view in the page to implements this requirement.

Does it possible to do in this way, do you have any clue on this?

Thanks in advanced!
epf  
#2 Posted : Wednesday, March 8, 2017 1:32:49 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
Actually, this means setting rowspan and colspan attributes in your table cells <td>
As you probably know, the table is built in the Model.cshtml template in this code:
Code:
                            <tbody>
                                @for (int row = page.DataTable.BodyStartRow; row < page.DataTable.BodyEndRow; row++)
                                {
                                    ResultCell[] line = page.DataTable.Lines[row];
                                    <tr class="@((row - page.DataTable.BodyStartRow) % 2 == 1 ? " " : " odd")">
                                        @for (int col = 0; col < line.Length; col++)
                                        {
                                            ResultCell cell = line[col];
                                            string className = cell.IsTitle && col == 0 ? "cell_title" : "cell_value";
                                            className = cell.IsTotal ? "cell_value_total" : className;
                                            <td class='@className' style='@cell.CellCssStyle' @Raw(Model.GetNavigation(cell))>@Raw(cell.HTMLValue)</td>
                                        }
                                    </tr>
                                }
                            </tbody>

that you can customize per view (e.g. testing cell.HTMLValue and inserting rowspan attribute...and forgetting the cell for the line after)....
another approach could be to do it by JavaScript after the table construction, you might find samples on internet.

but, I think that the DataTables component does not support rowspan and colspan in the tbody...so you will probably have to disabled it.

Good luck, your feedbacks are welcomed....

Edited by user Wednesday, March 8, 2017 1:34:19 PM(UTC)  | Reason: Not specified

thanks 1 user thanked epf for this useful post.
dino_l on 3/8/2017(UTC)
dino_l  
#3 Posted : Wednesday, March 8, 2017 2:56:23 PM(UTC)
dino_l

Rank: Newbie

Groups: Registered
Joined: 3/8/2017(UTC)
Posts: 2
China

Thanks: 1 times
Thanks for your quick response.
You answer is exactly resolve my issues, great. And I know rowspan, colspan etc, much appreciated again.

Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.