Hi experts,
um...I read the cellmerge section, and found the CellMerging feature is for the whole grid. Is there a way to cellmerge only a few lines? For example, I only need to merge the first row, column 3 to column 8? Thanks in advance.
Hello Ming,
CellMerging feature of the igGrid allows you to combine cells with same values next to each other in a column, not in a row. If you want to merge cells in a row, then you need to do it manually by modifying the DOM structure. If you need further assistance, feel free to contact me.
Best Regards,Tsanna Belcheva
Got it, thank you for your reply. I see the "merge" feature actually dims the same content in the same column, but they are still visible. Is there a way to make them invisible at all? Do i need to override "ui-iggrid-mergedcell" manually, set it's display:none, or there is a place for me to do the setting like
{ name: "CellMerging", initialState: "merged", mergedCellClass:MyCustomClass},
There is no such property as 'mergedCellClass' available in the CellMerging API. What I can suggest you in order to hide the merged cells is to handle cellMerged event and set 'rowspan' attribute to the top merged cell, which will be equal to the count of the merged cells, and hide the other merged cells. For instance:
cellsMerged: function(evt, ui){ ui.owner.grid.element.find("." + ui.owner.css.mergedCellsTop).attr("rowspan", ui.count); ui.owner.grid.element.find("." + ui.owner.css.mergedCell).hide(); }
However please note that features like Selection and Updating won't work correctly after making such modification to the grid DOM structure.
If you have any questions, please let me know.
Regards,Tsanna
Hi Tsanna, is there a way to specify which column should be merged, not the whole grid?
By default the merged column cells are these one that contain same values. You cannot explicitly set which columns should be merged. Please note also that CellMerging feature works along with Sorting feature and by default all sorted columns with similar values will be merged.
If you have any further questions, please let me know.
Regards,
Tsanna
Thank you very much. Like you said, cellmerged event is a better option.