Code: Select all
<Column header="Projects" filter={true} filterMatchMode="custom" body={this.convertAllProjectsToBetsAdmin} filterFunction={(...args) => true}/>
Code: Select all
var filterConstraint = filterMatchMode === 'custom' ? col.props.filterFunction : _ObjectUtils.default.filterConstraints[filterMatchMode];
if (!filterConstraint(dataFieldValue, filterValue)) { <----- ERROR THROWN HERE
EDIT: Ok I was able to get the filter by column working by setting the "field" attribute in the column. Still can't get the globalFilterFunction to trigger on global Filter change though
EDIT 2: Ok, apparently the globalFilterFunction isn't available yet in primereact, only primefaces. Does anyone know a way to manually call the custom filter function for each column from a global filter / input?
EDIT 3: Not as flexible as I would like but luckily i am trying to look for a value in an array so the 'contains' filterMatchMode works here. You want to define a ref on your table:
Code: Select all
<DataTable ref={el => {this.dt = el}} header={this.header}...
<Column field="projects" header="Projects" filterMatchMode="custom" body={this.convertAllProjectsToBetsAdmin} sortable={false} style={{width: "125px"}} filterFunction={this.filterFunction}/>
...
/>
Code: Select all
header =
<div style={{'textAlign':'left'}}>
<FontAwesomeIcon icon="search" />
<input onInput={(e) => {
this.dt.filter('49', 'projects', 'custom''); //49 is just an example search but its 'value', 'column', 'filterMatchMode'
... //could repeat for all columns if you want
}}
placeholder="Search"
size="50"
/>
</div>;
Code: Select all
filterFunction(value, filter){
console.log(value, filter);
return false;
}
EDIT 5: I couldn't really get multiple filters to work together, so if anyone knows a way to implement the global filter let me know please! For now I'm going back to filtering by column