-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Hey there,
I recently posted abut Search API not working properly. There was a fix to that ticket but the API seems still broken.
From the docs
Note: If a property value is not of type string, or in cases you don't specify a field for the column, you'll have to use the getValue function on the column in order to extract the desired value.
Signature: getValue: ({ tableManager, value, column, rowData }) => string
Example:
Let's say the field's value for a cell is an object:
{ ... , fullName: {firstName: 'some-first-name', lastName: 'some-last-name'} },
Its getValue function for displaying the first and last name as a full name, would be:
getValue: ({ value }) => value.firstName + ' ' + value.lastName
The returned value will be used for searching, sorting etc...
- Whenever I define a column that has NO
field
, search on this column never ever executes no matter if I have definedgetValue
or not. To make it searchable Im forced to define afield
key and it seems field key doesn't matter and as long as the key exists on the data it will work
// THIS DOESNT WORK. UNABLE TO SEARCH FOR THE VALUE RETURNED FROM getValue (no field defined)
id: 'info',
label: 'Info',
getValue: ({ rowData }) => {
return `${rowData.date} ${rowData.createdBy} ${rowData.location}`
}
// THIS IS WORKING (field defined)
id: 'info',
label: 'Info',
field: 'date',
getValue: ({ rowData }) => {
return `${rowData.date} ${rowData.createdBy} ${rowData.location}`
}
highlightSearch
is broken if you havegetValue
and customcellRenderer
id: 'info',
label: 'Info',
field: 'date',
getValue: ({ rowData }) => {
return `${rowData.date} ${rowData.createdBy} ${rowData.location}`
},
cellRenderer: ({ data }) => {
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
margin: '10px',
placeSelf: 'flex-start',
}}
>
<span>{data.date}</span>
<div>{data.createdBy}</div>
<div>
<strong>{location}</strong>
</div>
</div>
)
},