0
votes

I have a requirement to allow filter only when filter text is more than three characters. Is there any way to put some validation logic somewhere?

Looked at the ag-grid custom filter document but don't know which way is best to accomplish this with minimal coding. Looked at onFloatingFilterChanged in IFloatingFilterParams, onFloatingFilterChanged in Custom Floating Filter, and isFilterActive in IFilterComp but documentations are all fuzzy and there's no specific example for this purpose.

Anyone tried to implement this? What's the best way to accomplish this?

1
See How to Ask, and especially minimal reproducible example. The idea is you describe what you want to do, show what you tried, and tell us what results you get. Reproduce your issue on plunk or stackblitz so that others can help you easily. - Paritosh
Solved this with custom floating filter with onFloatingFilterChanged implementation following the example this.onFloatingFilterChanged = change => { const { minChars } = this.state; if(change && change.model && (!change.model.filter || change.model.filter.length >= minChars)) { return props.onFloatingFilterChanged(change); } return false; }; - flynhigh

1 Answers

0
votes

Solved this with custom floating filter component with onFloatingFilterChanged implementation following the example

constructor(props) {
  super(props);

  this.state = {
    minChars: props.minChars ? props.minChars : DEFAULT_MIN_CHARS,
  };

  this.onFloatingFilterChanged = change => {
    const { minChars } = this.state;
    if(change && change.model && (!change.model.filter || change.model.filter.length >= minChars)) {
      return props.onFloatingFilterChanged(change);
    }
    return false;
  };
}