bencripps / react-redux-grid

A React Grid/Tree Component written in the Redux Pattern
http://react-redux-grid.herokuapp.com/
MIT License
446 stars 63 forks source link

how to refresh with remote dataSource from another action #209

Open rednaxus opened 6 years ago

rednaxus commented 6 years ago

Suppose I have another component that does something that makes me want to re-load the remote dataSource. I should be able to call an action to reload, how do I do this?

diego-inflightvr commented 6 years ago

Hi @rednaxus, It's probably too late to answer your question, but just in case... This is how I did it:

import { Actions } from 'react-redux-grid'

store.dispatch( Actions.GridActions.getAsyncData({ showTreeRootNode: false, stateKey, dataSource: treeDataSource, type: gridType }))

Cheers, Diego

jiangenhe commented 6 years ago

In my case, I just gave a new key value to Grid component, which will force Grid to be remounted and reload all data. It may not be best way in terms of rendering performance but easy to be made.