multiple range search on buttons

multiple range search on buttons

Attitude007Attitude007 Posts: 8Questions: 0Answers: 0

Link to test case: http://live.datatables.net/netacira/2/edit

Hello guys,
I would like to know if anyone already done this kind of searchs

I did 2 range search on my table with 2 different buttons and not inputs (so i can send preselected values)
and it's working fine BUT i'd like to be able to select BOTH of them on the same time and not only one by one

And I would like to put a checkbox for each who can remember if the filter is actually ON or not (i can save the filter with stateSave: true But i don't know where i have to find the information about the ranged search to get the checkbox value true or false when i reload the page
(Cuz as you can see with the 'li' example i can do it for a simple search and i know what i have to search for // Ofc it's not working on example ... but nvm this part is working fine for me XD it was just to show you what i mean)
But the second part is a bit more optional ^^

I know my code is really painfull to see but like this you have a bit more idea about how i'm doing and what i wanna do

Sorry again if this question is kinda stupid or if i explain it badly ... Say me if you need more informations.

Replies

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    BUT i'd like to be able to select BOTH of them on the same time and not only one by one

    You can't have them both as they stand, as the logic is ANDed, so they would exclude each other. But what you can do is change the range when both are selected. And it would be tidier to use a class, rather than a checkbox, so the appearance of the buttons change.

    This should get you going, http://live.datatables.net/netacira/3/edit , the class needs some work, but it'll get you heading in the right direction.

    With stateSave, just add the classes of the two buttons, then apply them again (with a table draw) when loaded.

    Colin

  • Attitude007Attitude007 Posts: 8Questions: 0Answers: 0

    Thx a lot, it's weekend so i'll check it chill but it seems to be what i wanted to do :) Thx again

  • Attitude007Attitude007 Posts: 8Questions: 0Answers: 0

    Hello Colin, First of all thx again for the quick answer, then sorry for only responding now... Weekend... You know... hahaha

    So i checked your solution and it works fine but only if i have those 2 buttons, the fact is i have more than 2 :/

    I was thinking a bit more about something like this :
    http://live.datatables.net/qumituko/1/edit

    But i can't use searchPanes on my own project... I'm a bit sad to be honnest cuz it's working like i'd like but it's not matching with it
    As you can see it's possible to select 2 options like between 30-40 AND 50-60 at the same time... So i guess it should be possible to return 2 differents range of search but i can't find how to send these informations into my datatable without using searchPanes

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    I'm not clear if you want to use SearchPanes, or your own Buttons. The example I did before is entirely different to what you're posting now.

    To progress, can you show us what you want help with. Show us what you have in a small test case, so we can work with that,

    Colin

  • Attitude007Attitude007 Posts: 8Questions: 0Answers: 0

    I'm currently using the button example but with more than 2 buttons, so if i try to adapt what you sent me i'll get a loooooot of if_else condition ^^

    Cuz with your example if i had a third buttons with like 41-50 i currently can't select 21-30 and 41-50 without getting the ages between (i don't know if i'm explaining it well enought ^^)

    But with the searchPanes option you can do it (select 20-30 AND 40-50 AND >60) without getting the non expected values

    So, if it's possible with a plugin from datatable, i guess it should be possible to send these infos inside my datatable without using this plugin ? And apply my own filter without using searchPanes (Like i did with the check search on my example here http://live.datatables.net/netacira/2/edit)

    I mean, i use the search option of datatable but with my own utilities (getting the innerText of my input and using the search option // Not by using the casual search input from datatable) ...
    I'm sorry if this isn't clear enough and I can't express my desire. If I really can't make myself understood, I'll keep looking on my own. But to summarize, I would like to use the filter functions of searchPanes with buttons (in short). Or something else than buttons of course

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    Cuz with your example if i had a third buttons with like 41-50 i currently can't select 21-30 and 41-50 without getting the ages between (i don't know if i'm explaining it well enought ^^)

    Yep, that's true with my code, but it would be straightforward to change that to check for the break, you would just need to add additional logic to that search function.

    SearchPanes search is embedded, so you can't take the search out of it without using the extension - well, you can, but you would need to consider all the code in that extension, of course, and pretty much re-write it.

    The best approach would be to use the buttons that you have, and adjust the logic in the code I provided. What I gave was only a starting point, something for you to use a guide for your solution,

    Colin

  • Attitude007Attitude007 Posts: 8Questions: 0Answers: 0

    Yeah thx, i was a bit afraid about what you just said ^^
    I don't want to rewrite all the extension hahaha
    I was wondering if it was maybe possible to just 'extract' the search part....
    But thx again for answers, i'll just go deeper into the logic as you say ;)
    Thx again and get a good day :)

This discussion has been closed.