Skip to content

Search Api broken #111

@stychu

Description

@stychu

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...

  1. Whenever I define a column that has NO field, search on this column never ever executes no matter if I have defined getValue or not. To make it searchable Im forced to define a field 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}`
    }
  1. highlightSearch is broken if you have getValue and custom cellRenderer
    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>
      )
    },

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is neededquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions