Giter Club home page Giter Club logo

Comments (6)

torshid avatar torshid commented on June 10, 2024

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.

torshid avatar torshid commented on June 10, 2024

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.

albertodiazsaez avatar albertodiazsaez commented on June 10, 2024

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.

torshid avatar torshid commented on June 10, 2024

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.

albertodiazsaez avatar albertodiazsaez commented on June 10, 2024

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.

torshid avatar torshid commented on June 10, 2024

Great. Thank you :)

from springfilter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.