Happy-Coding-Clans / vue-easytable

A powerful data table based on vuejs. You can use it as data grid、Microsoft Excel or Google sheets. It supports virtual scroll、cell edit etc.
https://happy-coding-clans.github.io/vue-easytable/
MIT License
3.69k stars 738 forks source link

[Bug Report] Cell Selection Option enable: false does not work #409

Closed stephantabor closed 2 years ago

stephantabor commented 2 years ago

https://github.com/Happy-Coding-Clans/vue-easytable/blob/674d87e8e72151bf02844a53c7245ae55ceb8468/packages/ve-table/src/body/index.jsx#L416-L420

this condition is always true, causing cell selection to always occur. this is one of the things seems to cause a re-render of every cell in the table when you click any given cell.

it should likely be instead

              ! !(
                    cellSelectionOption &&
                    typeof cellSelectionOption.enable === "boolean" &&
                    cellSelectionOption.enable === false
                )

or simply

               (
                    cellSelectionOption &&
                    typeof cellSelectionOption.enable === "boolean" &&
                    cellSelectionOption.enable === false
                )

Reproduction: https://stackblitz.com/edit/vuejs-starter-q8uzw6?file=table.js

toggle a table on and then click a cell

huangshuwei commented 2 years ago

Cell selection is enable by default. This feature is turned off only when cellselectionoption.enable=false

There is something wrong with your example:

 :cell-selection-option="{ enabled: false }"

Turned off the cell selection should be:

 :cell-selection-option="{ enable: false }"

I have modified your reproduction: https://stackblitz.com/edit/vuejs-starter-ecsyxq?file=table.js

stephantabor commented 2 years ago

You're right, my issue locally was that I had a nested table and the inside table had it set and the outside table did not