virtualized-table-for-antd
virtualized-table-for-antd copied to clipboard
Doesn't work with immutable records
I'm working with GraphQL generation and the records of my data source are immutable (non extensible objects) (see: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions).
So this line: https://github.com/wubostc/virtualized-table-for-antd/blob/66f0e80c6a82e70b25574c36c4b6b39e3f81b73f/src/vt.tsx#L727 doesn't work and triggers the following error: TypeError: Cannot add property Symbol(idx), object is not extensible
Would it be another way to keep the index? Maybe with a map using rowKey as key?
Every row needs an index that held with the prop record
, which I can determine the true index number of every row, and don't worry about whether the dataSource
is a tree-structure or a nested-structure.
To solve this problem, I have to write something like row.props.record[row_idx]
to keep a true index number
Could you solve this problem instead of that I mentioned above, and create a new PR with a branch?
Tips: there are a few things need to be changed below (at least)
- Initial state within
VTWarpper
https://github.com/wubostc/virtualized-table-for-antd/blob/66f0e80c6a82e70b25574c36c4b6b39e3f81b73f/src/vt.tsx#L727 - Running state within
VTWarpper
https://github.com/wubostc/virtualized-table-for-antd/blob/66f0e80c6a82e70b25574c36c4b6b39e3f81b73f/src/vt.tsx#L791 - Determining the true index number within
VTRow
https://github.com/wubostc/virtualized-table-for-antd/blob/66f0e80c6a82e70b25574c36c4b6b39e3f81b73f/src/vt.tsx#L841
Has there been any progress on this? I am now running into this issue too.
@PunkOnWheels I haven't had any ideas so far
Hi @wubostc Made an attempt here: https://github.com/wubostc/virtualized-table-for-antd/pull/132
@Vincz @PunkOnWheels solved! 👍