I've added some sorting and filtering to fields defined with the plugin.
The code looked very boiler-platey, so maybe it could be included in the plugin?
.replaceFieldSorting(newFieldName, [
{ field: fieldName, ascending: true },
])
.replaceFieldOperator(newFieldName, 'Equal', (v) => ({
field: fieldName,
operator: 'Equal',
value: v ? enumObject[v] : null,
}))
.replaceFieldOperator(newFieldName, 'NotEqual', (v) => ({
field: fieldName,
operator: 'NotEqual',
value: v ? enumObject[v] : null,
}))
.replaceFieldOperator(newFieldName, 'Present', () => ({
field: fieldName,
operator: 'Present',
}))
.replaceFieldOperator(newFieldName, 'Blank', () => ({
field: fieldName,
operator: 'Blank',
}))
I don't know if there are subtle implications to this, for example on matters of performance.
If so, it might be worth hiding these behind enableSorting / enableFiltering options.
I've added some sorting and filtering to fields defined with the plugin.
The code looked very boiler-platey, so maybe it could be included in the plugin?
I don't know if there are subtle implications to this, for example on matters of performance.
If so, it might be worth hiding these behind
enableSorting/enableFilteringoptions.