Keep merging nestedRows parent

Tags: #<Tag:0x00007f8b1cefd798>

I want to keep mergeing nestedRows parent
even if collapse(- click) or expand(+ click).

How can i do it?

using handsontable for react.

Code:

const mergeCells = [
{ row: 0, col: 0, rowspan: 1, colspan: 4 },
{ row: 6, col: 0, rowspan: 1, colspan: 4 },
];

return <HotTable data={data} colHeaders={headers} rowHeaders={true} nestedRows={true} mergeCells={mergeCells} />;

Hi @m_murayama

The cooperation between those plugin hasn’t been officially established yet. I will do my best to check what can be done and will update you later today.

1 Like

Hi @m_murayama

I checked if we could use any hook (as nestedRows does not have hook API) and found out that beforeOnCellMouseDown is the only hook that is called when we click the expand/collapse icon in the row header.
So I’ve used it to check if the clicked element is the collapse/expand button

arguments[2].classList[1] == ‘ht_nestingParent’

Further in the code, I wanted to use updateSettings method to update the row of a merged area.

However, the updateSettings method shows the collapsed section. To overcome this limitation I called the collapse method again

hot.getPlugin(‘nestedRows’).collapsingUI.collapseChildren(0);

However, the issue is that the parent does not want to expand.

Here is my latest progress https://jsfiddle.net/sj7pf38b/7/ I wasn’t able to fix the auto-collapsing effect but I think that this can be the start of a good workaround so I wanted to share it with you.

thanks @aleksandra_budnik

i will try this code. and i think a little for better way.

Hi @aleksandra_budnik

I used mergeCells plugin, can merge parent without the collapsed section.

hot.getPlugin('mergeCells').merge()

it does not work readOnly Column.
Is there any way around it?

Hi @m_murayama

sorry for the delay.

That’s true. The hot.getPlugin('mergeCells').merge() won’t work this way https://jsfiddle.net/bq91hn35/.

However, we can do mergeCells + readOnly this way https://jsfiddle.net/AMBudnik/wkxehnyL/
Would that suit your project, @m_murayama/?

Hi @aleksandra_budnik

The way using updateSettings is not suitable for our project as it causes collapse and expand problems.

After all, we decided to remove the “collapse and expand” requirement.

thanks for help

1 Like