Skip to content

how to refresh data in reactjs with typescript? #170

Description

@SunnyXiao

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


}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions