Comments (6)
Thanks for participating. :)
Just wondering, isn't it possible in this case to search with firstName : 'John' and lastName : 'Smith'
? Not sure what is the advantage of using ~
here.
I can be more helpful if you can give more details about your use case.
Your globalFilter proposition seems too complex to implement for this specific case. But I think that string concatenation might be useful here, it would be possible to do things like concat(firstName, concat(' ', lastName)) ~ 'John%Smith'
. The concat
function isn't implemented currently but that can be easily done.
from springfilter.
You may check https://github.com/turkraft/spring-filter/releases/tag/1.0.2. I think that you will be now be able to do your search with what I described earlier. If not, you can always reopen the issue or create a new one.
from springfilter.
The concatenation should work. I forgot completely to tell why I need this... >.<
I have a fontend table, and multiple columns, and if I want to use a single search field to search in multiple columns (name/surname/phone/etc), the globalFilter is very useful. The idea is that I can't identify what is going to be on that field, that's why I can't use firstName : 'John' and lastName : 'Smith'
, but concat(firstName, concat(' ', lastName)) ~ 'John%Smith'
should work.
To simplify the syntax, I suggest doing a `concat(firstName, ' ', lastName, etc)~'John%Smith' if it's possible, so we don't have to write concat a lot and keep everyhting in the same parenthesis, just a suggestion though.
The concat would be only for filtering right? It's not going to modify the data that it's being returned?
Thank you!
Edit: I did not check #76 before writing this, and you did change the syntax for the concat :P
from springfilter.
I understand now. I assume that you have a single column which combines the first and last names in your frontend, and you want a single search field for that column. The concat
usage is the most suitable which comes to my mind.
And you are right, the data is absolutely not modified here, the functions and all the operators are only used for the filtering logic. So the concat
method should not cause any problem. You may modify the data once you fetch it if that's needed.
By the way, what are you using in your frontend? I am planning to build a JS/TS query builder when I have time, it would be interesting to get your requirements.
from springfilter.
The concat operator should be perfect for my use case ^ยท^
I'm using Angular with TS for my frontend, more specifically, the Prime NG library (Primefaces version for Angular), but the client should be generic enough to be used in Angular, React, so I would suggest doing it on JS.
from springfilter.
Great. Thank you :)
from springfilter.
Related Issues (20)
- Avoid duplicates HOT 5
- Escaping wildcard characters in "LIKE" queries HOT 2
- Add multiple joins in nested list HOT 1
- [MongoDB] $in with ObjectId HOT 2
- Global case insensitive search HOT 1
- Opportunity to use functions on the right side of the comparators HOT 1
- Discord Server HOT 2
- Unable to filter on List of Strings HOT 2
- Add new module for deserialization in the @Filter annotation HOT 4
- Implement `NotLike` value comparator. HOT 1
- Mongo filter collections HOT 3
- Showcase - how do you use Spring Filter? HOT 1
- Customizing the escape character for like operations (`~` and `~~`) HOT 3
- Filter by Map in Mongo HOT 1
- Mongo filtering nested fields not working in 3.x.x version HOT 2
- Case insensitive equals search
- Possible to filter without Spring boot controller? HOT 1
- MongoDB - query by DBRef HOT 2
- Make field not searchable HOT 1
- Any extended support for Quarkus? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from springfilter.