React-table: Is there possible for without case sensitive in column search?????

Created on 22 Jun 2017  Â·  5Comments  Â·  Source: tannerlinsley/react-table

Is there possible for case sensitive search in column search?????

Most helpful comment

This is what we are using for a custom filter... it is not case sensitive, and also searches full text instead of just the start of the word:

customFilter = (filter, row) => {
    const id = filter.pivotId || filter.id;
    if (row[id] !== null && typeof row[id] === "string") {
      return (row[id] !== undefined
        ? String(row[id].toLowerCase()).includes(filter.value.toLowerCase())
        : true);
    }
  }

and then when calling <ReactTable />:

defaultFilterMethod={this.customFilter}

Hope that helps.

All 5 comments

I do believe the standard filter method is case sensitive?

Thanks for giving reply.then is there any way to get without case
sensitive????

On Jun 22, 2017 12:33 PM, "cbll" notifications@github.com wrote:

I do believe the standard filter method is case sensitive?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tannerlinsley/react-table/issues/356#issuecomment-310294330,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AUAFhTBryb7xicLD0W7p6YdjrBLQEv8Aks5sGhHOgaJpZM4OB3mi
.

Ease on the questionmarks man :)

Yes, just search the issues, it's been brought up a lot of times.

This is what we are using for a custom filter... it is not case sensitive, and also searches full text instead of just the start of the word:

customFilter = (filter, row) => {
    const id = filter.pivotId || filter.id;
    if (row[id] !== null && typeof row[id] === "string") {
      return (row[id] !== undefined
        ? String(row[id].toLowerCase()).includes(filter.value.toLowerCase())
        : true);
    }
  }

and then when calling <ReactTable />:

defaultFilterMethod={this.customFilter}

Hope that helps.

This breaks other filters with integer data types

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BenMGilman picture BenMGilman  Â·  22Comments

sshaginyan picture sshaginyan  Â·  21Comments

Codar97 picture Codar97  Â·  17Comments

larrybotha picture larrybotha  Â·  20Comments

vaidsu picture vaidsu  Â·  29Comments