inovua / reactdatagrid

Empower Your Data with the best React Data Grid there is
https://reactdatagrid.io
Other
3.45k stars 57 forks source link

Ability To Add and Delete In Infinite Scroll Enabled Enterprise Table #378

Open andrewhawk1ns opened 10 months ago

andrewhawk1ns commented 10 months ago

Relevant code or config

 <ReactDataGrid
        idProperty="_id"
        livePagination
        onReady={setGridRef}
        dataSource={handleLoadMore}
        onLoadingChange={setPaginationLoading}
   />

What you did:

Added infinite scroll (live pagination) to the data grid.

What happened:

I tried to remove an item from the table via setItemsAt but there is code in the reactdatagrid repository stopping me from doing that:

const setItemsAt = (items, config) => {
        for (let i = 0; i < items.length; i++) {

This code just loops through the existing items length and updates the item at the corresponding index so I cannot remove items from the table.

Problem description:

There's no way to remove items or add items to an infinite scroll enabled datatable without controlling the rows myself which then causes the scroll to jump from the rerender.

Suggested solution:

Really need a deleteItemAt and addItem to be able to add or delete an item when infinite scroll (live pagination) is enabled or at least have the setItemsAt allow for items to be removed and added when infinite scroll is enabled.