[GH #2324] disableVisualSelection not working as expected after v.15.1

Tags: #<Tag:0x00007f51b9033178> #<Tag:0x00007f51b9032fc0>

Hi,
After the update to v15.1, disableVisualSelection: true stopped working in some cases. As you can see in this example, the visual selection is shown although the property is set to true.

Removing the afterOnCellMouseUp fixes the issue. It seems that the re-render triggered by that hook is messing with the behavior of the disableVisualSelection property.

Help is appreciated since this is currently preventing us from updating.

Best,
Nico

Hi @nico.kastunowicz

Thank you for contacting us. I am not able to edit the example you sent so I prepared a new one: https://jsfiddle.net/w1t0gmk5/ The option works just fine.

What I noticed in your code is the not correct declaration of the settings:

<HotTable
          data={this.data}
          settings={{
            disableVisualSelection: true,
          }}
          afterOnCellMouseUp={this.handleMouseUp}
          colHeaders={true}
          rowHeaders={true}
          width="600"
          height="300"
        /> 

The disableVisualSelection option shouldn’t be wrapped in another object, the settings in this configuration are declared directly in the HotTable, just like the other options you have there.

Hey Adrian,

Thanks for you answer. I have updated the example with your suggested declaration if the property, which doesn’t have an impact. The bug seems to be linked to the re-render behavior in react which is triggered through the afterOnCellMouseUp hook. Updating a random state in this component should not have an impact on the configuration of the HoT table, so unfortunately your suggested fiddle doesn’t help me.

Best,
Nico

Hi @nico.kastunowicz

Thank you for the clarification. I checked that you are right, it’s caused by the state changes within the hook. The table is being re-rendered multiple times in that situation. Can you please tell what are your requirements? Specifically in terms of what logic do you plan to implement within the afterOnCellMouseUp hook.

Hey,

So we are using HoT as a selection table of elements, where the selected row is highlighted. In the afterOnCellMouseUp hook we set a state to track the selected row to later apply styling to it. This means that after the afterOnCellMouseUp, the state change leads to a re-render which in turn seems to trigger the problem with the disableVisualSelection property.

Best,
Nico

Hi @nico.kastunowicz

Thank you for the explanation. In this case there won’t be other way to meet your requirements. I’ll report this issue internally and update you once I have more information on the possible fix.