Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case-sensitive search #152

Open
munawwars opened this issue May 20, 2016 · 4 comments
Open

Case-sensitive search #152

munawwars opened this issue May 20, 2016 · 4 comments

Comments

@munawwars
Copy link

Need an ability to ignore case while searching through the table.

@raquelleira
Copy link

I just added toLowerCase...
item[config.filtering.columnName].toLowerCase().match(this.config.filtering.filterString.toLowerCase()));

@Sal80
Copy link

Sal80 commented Mar 20, 2017

I realize this is an old thread, but I tried your .toLowerCase() method for case insensitive filtering, however, when I add that, I get this error:
Error: Expression has changed after it was checked.

@NABEEL-AHMED-JAMIL
Copy link

public changeFilter(data:any, config:any):any {
let filteredData:Array = data;
this.columns.forEach((column:any) => {

  if (column.filtering) {
  
    filteredData = filteredData.filter((item:any) => {
      return item[column.name].match(column.filtering.filterString);
    });
  }
});

if (!config.filtering) {
  return filteredData;
}

if (config.filtering.columnName) {
  
  return filteredData.filter((item:any) =>{
   
    item[config.filtering.columnName].match(this.config.filtering.filterString)});
}

let tempArray:Array<any> = [];
filteredData.forEach((item:any) => {
  let flag = false;
  this.columns.forEach((column:any) => {

    
        if (item[column.name].toString().match(this.config.filtering.filterString)) {
                
                  flag = true;
        }

        if(column.name == "name"){
              if (item[column.name].toLowerCase().toString().match(this.config.filtering.filterString)) {
                        
                        flag = true;
                }
            }
   
  });
  if (flag) {
    tempArray.push(item);
  }
});
filteredData = tempArray;

return filteredData;

}

@NABEEL-AHMED-JAMIL
Copy link

See this Condition that is used for my project

if(column.name == "name"){
if (item[column.name].toLowerCase().toString().match(this.config.filtering.filterString)) {

                        flag = true;
                }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants