Searchpanes by range rather than specific value, i.e. population range, <2,500 , and >2,500

Searchpanes by range rather than specific value, i.e. population range, <2,500 , and >2,500

Larry27Larry27 Posts: 35Questions: 10Answers: 0

https://www.baldwinproject.ca/app/on/municipal_list.php
https://debug.datatables.net/amejih**:
**No error
:
I want to be able to search on population and household ranges, rather than the individual population and household values.:
For example;
0-2,500,
2,500-5,000,
5,000-7,500

Any help you can offer would be greatly appreciated

Thanks,

Larry

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    Yep, that's possible. This example should get you going, it's showing how to use ranges in the age column.

    Colin

  • Larry27Larry27 Posts: 35Questions: 10Answers: 0

    Thanks Colin, much appreciated. Just wondering, does the DOM have to be P or can it be B? I prefer the buttons to call the searchpane into view, rather than displaying it all the time.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Yep, it can be a 'B' - see this example. The same config would apply above, it's just how the panes are displayed.

    Colin

  • Larry27Larry27 Posts: 35Questions: 10Answers: 0

    I think I've got it, but I am still having trouble. If I use the DOM 'B' I get "No data available in table", and no values. If I use 'P' I see my filtered list of, but still no values.

    I'm guessing it's my JAVA script, but cannot see where the problem is.

    Can you help? THis is my page https://www.baldwinproject.ca/app/on/municipal_list.php

    here is my js page...

    https://www.baldwinproject.ca/app/on/js/municipal_list-Test.js

    ANY help you can offer would be greatly appreciated.

    Larry

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    Hi Larry,

    When I load your page at the moment, I see you are using dom: 'Bfrtip',, but the table is loading data okay:

    How can I get it to the point of not working (i.e. showing "No data available in table")?

    Allan

  • Larry27Larry27 Posts: 35Questions: 10Answers: 0

    Just click on the Filter Button and you'll see in the searchpanes, on the far right of the searchpane for households says "no data available in table"

    This is the page with DOM as 'Bfrtip'

    https://www.baldwinproject.ca/app/on/municipal_list.php

    This is the page with DOM as 'Pfrtip' which populates the searchpane for the filters I wat to apply, but doesn't seem to be picking up the underlying records.

    https://www.baldwinproject.ca/app/on/municipal_list-P.php

    At first I thought it was something with my JSON file which which has the population and household values in quotes like this "56998", but when I removed the quotes, I got the same result, so I'm stumped now, lol.

  • Larry27Larry27 Posts: 35Questions: 10Answers: 0

    Hi, Just following up on this. Any suggestions on where I might be going wrong?

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    Hi,

    Really sorry I lost track of this one. It looks like you are using quite an old version of SearchPanes on the page (a 2.0.0 development version). Could you try updating to the latest release (2.1.1) which will hopefully resolve this? And even if not it gives me a better base point to investigate further.

    Thanks,
    Allan

  • Larry27Larry27 Posts: 35Questions: 10Answers: 0

    Hi Allan,

    I've now updated to the most recent version. I'm having a formatting issue now, but honestly that's minor. I'd really just like to get this search pane issue fixed first.

    Thanks,

    Larry

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin
    edited March 2023

    Hi Larry,

    municipal_list-P.php

    The filter isn't working in this example because of the use of array indexes to access the row data for the comparison - e.g. rowData[6]. Since you are using object based data it should actually be rowData.Households.

    municipal_list.php

    The options don't show up on this one as the configuration for a Buttons' based SearchPane takes is options for a config object on the button, not the (table) global searchPanes option. See this little example I've just put together to demonstrate this.

    The idea is that you'd be able to have multiple SearchPane buttons (if one wished to do so!).

    Allan

  • Larry27Larry27 Posts: 35Questions: 10Answers: 0

    Allan,

    That worked like a charm. Thanks so much sir.

    Larry

Sign In or Register to comment.