paramquery / grid

jQuery grid plugin based on jQueryui widget design
paramquery.com
GNU General Public License v3.0
543 stars 255 forks source link

how to refresh data in reactjs with typescript? #170

Open SunnyXiao opened 5 years ago

SunnyXiao commented 5 years ago

hello, i used grid in reactjs with typescript, when i change dataModel, the grid is not refresh; and how to solved? my code is following: "pqgrid": "^6.2.4", "typescript": "^3.1.6", "react": "^16.9.0",

grid.tsx:

export default class Pqgrid extends React.Component<any, {}>{

componentDidMount() { //@ts-ignore this.options = this.props.options; //@ts-ignore this.grid = pq.grid(this.refs.grid, this.options); //@ts-ignore console.log('render grid', this.grid) } componentDidUpdate(prevProps) { //@ts-ignore console.log('this.options:', this.options) //@ts-ignore Object.assign(this.options, this.props.options); //@ts-ignore this.grid.option("colModel", this.options.colModel) //@ts-ignore this.grid.option("dataModel", this.options.dataModel) //@ts-ignore this.grid.refreshDataAndView(); } render() { return

} }