Skip to content

Instantly share code, notes, and snippets.

@maxkoretskyi
Created April 10, 2019 11:05
Show Gist options
  • Save maxkoretskyi/123e35b0b91c07da63a8536e80bb6aa2 to your computer and use it in GitHub Desktop.
Save maxkoretskyi/123e35b0b91c07da63a8536e80bb6aa2 to your computer and use it in GitHub Desktop.
export class AgGridReact extends React.Component {
componentWillReceiveProps(nextProps: any) {
const changes = <any>{};
const changedKeys = Object.keys(nextProps);
changedKeys.forEach((propKey) => {
...
if (!this.areEquivalent(this.props[propKey], nextProps[propKey])) {
changes[propKey] = {
previousValue: this.props[propKey],
currentValue: nextProps[propKey]
};
}
});
AgGrid.ComponentUtil.getEventCallbacks().forEach((funcName: string) => {
if (this.props[funcName] !== nextProps[funcName]) {
changes[funcName] = {
previousValue: this.props[funcName],
currentValue: nextProps[funcName]
};
}
});
AgGrid.ComponentUtil.processOnChange(changes, this.gridOptions, this.api, this.columnApi);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment