Hi there
Basically, when I add code to an event hook function associated with the event stops working.
For example, I want to set a flag when a filter is applied to a column, so I register the hook afterFilter and have it set a page state value when a filter is completed. However, the presence of code in that hook prevents the filter from working, and nothing happens after I enter data in the filter, and click OK.
I assume I’m correctly doing things, but am open to the possibility that I’m doing it wrong. Thanks in advance.
Here’s an example. I’m using react, by the way.
componentDidMount() {
const hti = this.hotTableComponent.current.hotInstance;
hti.addHook("afterFilter", this.afterFilter);
}
afterFilter = (e) => {
//comment out the line below to have filters work
this.setState({ gridIsFiltered: true });
};
The Grid settings are:
hotSettings = () => {
return {
licenseKey: "non-commercial-and-evaluation",
data: this.props.values.dataToView,
colHeaders: this.colHeaders(),
colWidths: this.colWidths(),
columns: this.columns(),
rowHeaders: true,
readOnly: false,
manualColumnMove: true,
manualRowMove: true,
manualColumnResize: true,
manualRowResize: true,
filters: true,
dropdownMenu: [
"filter_by_condition",
"filter_by_value",
"filter_action_bar",
],
columnSorting: true,
contextMenu: this.contextMenus(),
autoWrapRow: true,
};