AG-Grid with Redux

In my work, we decided to use AG-Gridin the reaction variant: https://www.ag-grid.com/best-react-data-grid/index.php

Currently our architecture for Reactmake up Redux. From my little knowledge, AG-GridI can say that it is not very suitable for this architecture. AG-Gridmaintains the general state inside the component. It is cumbersome or not even smart to try to connect it to reduction by force and completely.

I can live with this, but at least I need to follow the changes in the model line - this means selecting new lines, sorting, filtering (I do not need to follow the changes in the cells). I have 2 ideas on how to watch this and connect it to the reduct.

Option 1 - Use gridOptions.onModelUpdated ()

C gridOptions.onModelUpdated()I know when filtering or sorting was done, but I can’t get to all the displayed lines ( docs ):

State 1: row data

API: There is no API to retrieve this data. However, it was provided by the application, so you should already have it.

Thus, I cannot submit the action Reduxbecause I have no data to update it.

Option 2 - datasource.getRows ()

I could send actions with new lines. However, I did not find any event onReset/onRowsDeleted/..., so I do not know when to clear the reductions state.rows. Update . I know that previous lines were cleared if argumernt paramsof datasource.getRows(params)- params.startRow === 0.

Question

, , :

, AG-Grid Redux?

+4

Source: https://habr.com/ru/post/1648739/


All Articles