This topic is locked
[SOLVED]

 Filter list on demand with button

3/4/2011 9:23:43 PM
PHPRunner General questions
C
CodeDog author

I've owned PHPR for a while now and made a few simple apps over time, but am just really getting into it on a current project. And of course I have a question.
As part of the database I have one simple table that will list tasks. One of the fields in the table contains the date the task was completed. What I'd like to do is two things: first, I'd like the list initially filtered on this date field to show only uncompleted tasks (empty date field) when the app is loaded; second I'd like to add two buttons on the list screen (easy enough in the visual editor) that would change the filter back and forth between uncompleted tasks (empty date field) and completed tasks (date field contains a date). I don't want the user to have to enter anything, just click the buttons.
I've looked at the "Add dropdown list box with values for search" in the documentation, and at FunkDaddy's "Filter list on demand with dropdown" thread under Tips and Tricks in the forum, but am still a little unclear as to the best way to handle this. Seems like it should be easy enough, but I'm not having any luck through trial and error.
Any suggestions/direction would be appreciated. Thanks...

Sergey Kornilov admin 3/5/2011

Run both searches using either search panel or advanced search page. Save both URLs and add two links/buttons on the List page that point to respective URLs. This is it.

C
CodeDog author 3/5/2011



Run both searches using either search panel or advanced search page. Save both URLs and add two links/buttons on the List page that point to respective URLs. This is it.


Thanks Sergey, appreciate the response. Very simple and easy alternative I hadn't thought of.
Few things, though. The 'Insert/Button' option only inserts a code button, it doesn't let you add a button for a simple hyperlink. I tried creating a couple button graphics to use, but for some reason the visual editor wouldn't let me insert more than one image.
I finally just created text links to test it out, and that worked. The problem is that after I've clicked on either one of those options and have the filtered list I want showing, clicking the 'Show All' button redisplays the page with all records but the 'Loading...' box just continues to sit there. I can reload the page, but the 'Loading...' box comes back and still continues to sit there. As long as it's there I don't have access to any of the app options, I have to close the window or click the back button. Basically, once I've clicked either of the links I inserted I can't do a 'Show All'. If, however, I do a quick search or advanced search to filter the records instead of clicking one of the two hyperlinks, I can then do a 'Show All' and it works. I've tried multiple builds and keep getting the same thing. Since the rest of it works, I may have to just remove the 'Show All' option. I'm using the latest build of PHPR.
Also, I'm still not sure where in PHPR to initially set a filter while entering the list screen, but I may just not bother with that. Thanks again...

Sergey Kornilov admin 3/5/2011

Not sure why 'Show all' button behaves this way but here are other answers.
You can use 'Insert button' feature in PHPRunner and the following redirect code in ClientBefore event:

window.location = "http://www.google.com/";


Put your URL there.
The initial sort/filter can be set right in SQL Query (SQL Query screen in PHPRunner).

C
CodeDog author 3/5/2011



Not sure why 'Show all' button behaves this way but here are other answers.
You can use 'Insert button' feature in PHPRunner and the following redirect code in ClientBefore event:

window.location = "http://www.google.com/";


Put your URL there.
The initial sort/filter can be set right in SQL Query (SQL Query screen in PHPRunner).


Thanks again, Sergey. I was going to use this code in the button, but wasn't sure if there were any other issues. Appreciate it.
And I did finally realize I could set the initial sort in the SQL Query, must have been a senior moment there.
I can't figure out the issue with the 'Show All' button either. I finally just did the same thing you suggested with the other two options - did an advanced search for everything and created an option using that link, and removed the 'Show All' button. That works fine, shows all records. I tried it in multiple browsers on a couple different systems, and it always behaves the same way with the button. Redisplays the page with all records, but continues to display the 'Loading...' message until you either close the window or go back a page. In any case, it's working for now. Thanks for the help and suggestions...