To merge 4 cells (2rows and 2 columns)


Is there any way to merge 4 cells (2rows x 2columns) together?
Suppose we have the following header:

The question is how to merge cells 2-2,2-3,3-2,3-3 together.

I found some kind of solution, but not sure if it is proper one because this solution has a trick to balance cells quantity in the third row. I wonder if it may cause any error somewhere later in grid methods.

Here is the way I implement the task:
grid.attachHeader(“3-1,#rspan,3-4”);//here only 3 cells

May be it could be done other way without tricks. I’ll appreciate any comments


Yes, of course. in my opinnion, could be:

grid.setHeader(“4 cells merge,#cspan”)

if you want merge more cell, you only need insert more cspan and rspan, for example:

(4 columns * 2 rows)


I think so could be:

grid.attachHeader(“2-1,merge 4 cell,#cspan,2-4”);


Thank you for your response.
For some reason it doesn’t work properly for me this way:

grid.attachHeader(“2-1,merge 4 cell,#cspan,2-4”);

If I put #rspan two times in the third header row then all cells go crazy:?
I think the problem is that both #cpan and #rspan is applied for one cell at the same time. I’ve seen somewhere in this forum that it’s not allowed for the grid.

Only for the following creates table cells properly for me:

grid.attachHeader(“3-1,#rspan,3-4”);//here only 3 cells instead of 4

The above overcomes only html generation and only for header rows except the first one. It doesn’t seem to be a clear solution. I don’t think also that the rest functionality will work properly in this way.
I doubt that advanced merging is supported in the current version of the grid component, only simple merging.
I found smarter solution :wink: - change header to avoid this kind of advanced merging :slight_smile:


How to merge/split cells in dhx grid suite 6?any dhx API/method exist?


Here you can find tutorial about adding the spans in the dhtmlxGrid 6: