simov / express-admin

MySQL, MariaDB, PostgreSQL, SQLite admin for Node.js
MIT License
1.17k stars 222 forks source link

Filter Query with regex formation. #122

Closed dpz3579 closed 7 years ago

dpz3579 commented 7 years ago

Hi

I am using filter provided by express-admin.

I know this is a very small issue,

but when i filter a name as Abc in my search input field, it returns on only those records which start with name Abc

Suppose i have a record with name Xyz Abc, it is never returned.

but when i put input as %Abc%, both the records are returned,

can you please help me with where this update is to be done, i looked in lib folder, but unable to find where the search query is fired into.

dpz3579 commented 7 years ago

Hi have found an solution

Replaced line Line 144 of lib/qb/lst.js var expr = expression(table, column.name, column.control, value);

with my snippet

if(parseInt(value)){
var expr = expression(table, column.name, column.control, value);
}else{
var expr = expression(table, column.name, column.control, "%"+value+"%");
}

My query was of type %value% so have updated the necessary, Closing issue here.