Hello!
I was looking over the documentation and previous answers, and I have a scenario that I can seem to find an answer for. I've been assigned a task to update the filter drop down which includes the options of "Is null", "Is not null", "Is empty", "Is not empty". We have some non-technical people that don't really understand was 'Is null' means, and the difference between null and empty, so i'm trying to update these filters values.
The solution I would like to implement into the grid is to have the filter operators defined below.
I would like to have two custom operators in the drop down called "Is blank" and "Is not blank", which would implement two operators each.
Is this possible?
I was looking over the documentation and previous answers, and I have a scenario that I can seem to find an answer for. I've been assigned a task to update the filter drop down which includes the options of "Is null", "Is not null", "Is empty", "Is not empty". We have some non-technical people that don't really understand was 'Is null' means, and the difference between null and empty, so i'm trying to update these filters values.
The solution I would like to implement into the grid is to have the filter operators defined below.
const filterOperators = { text: [ { text: "grid.filterContainsOperator", operator: "contains" }, { text: "grid.filterNotContainsOperator", operator: "doesnotcontain" }, { text: "grid.filterEqOperator", operator: "eq" }, { text: "grid.filterNotEqOperator", operator: "neq" }, { text: "grid.filterStartsWithOperator", operator: "startswith" }, { text: "grid.filterEndsWithOperator", operator: "endswith" }, { text: "Is Blank", // Custom text for "Is Blank" operator: "isempty, isnull" }, { text: "Is Not Blank", // Custom text for "Is Not Blank" operator: "isnotempty, isnotnull" } ] };
I would like to have two custom operators in the drop down called "Is blank" and "Is not blank", which would implement two operators each.
Is this possible?
const filterOperators = { text: [ { text: "grid.filterContainsOperator", operator: "contains" }, { text: "grid.filterNotContainsOperator", operator: "doesnotcontain" }, { text: "grid.filterEqOperator", operator: "eq" }, { text: "grid.filterNotEqOperator", operator: "neq" }, { text: "grid.filterStartsWithOperator", operator: "startswith" }, { text: "grid.filterEndsWithOperator", operator: "endswith" }, { text: "Is Blank", // Custom text for "Is Blank" operator: "isempty,isnull" }, { text: "Is Not Blank", // Custom text for "Is Not Blank" operator: "isnotempty,isnotnull" } ] }; return ( <Grid data={data} {...dataState} reorderable sortable={sortable} onDataStateChange={onDataStateChange} onColumnReorder={onColumnReorder} style={style} {...virtualScroll} {...selection} rowRender={rowRender} {...otherProps} resizable={resizable} filterable={filterable} filterOperators={filterOperators} > {toolBar && <GridToolbar>{toolBar}</GridToolbar>} {selection && ( <GridColumn field={selection.selectedField} headerSelectionValue={ data.data && data.data.findIndex((dataItem) => dataItem.selected === false) === -1 } filterable={false} sortable={false} reorderable={false} /> )} {columns && columns .filter((x) => x.show) .map((x) => { const headerClassName = dataState?.filter?.filters.some(y => y.field === x.field) ? 'active' : ''; return ( <GridColumn key={x.field + Math.random() * 1000} headerClassName={`${headerClassName} ${x.headerClassName}`} field={x.field} title={x.title} width={x.width} orderIndex={x.orderIndex} filter={x.filter} format={x.format} cell={cellFunctions && cellFunctions[x.field]} reorderable={x.reorderable} sortable={x.sortable} filterable={x.filterable} editor={x.editor} editable={x.editable} filterCell={filterCells && filterCells[x.field]} /> ); })} </Grid> ); }