Show me the sorting!

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Show me the sorting!

Post by shasta59 » 2013-03-16 22:37

Hello

Been a while since I have posted so here is one more trick I am using.

Since it is easier to save the find/sort filters I use rather than have to create them new each time I created a page for them. It also allowed me to allow other groups to see and use the filters and get rid of the 'how do I do this" emails.

Here are the steps I used:

1. Create the filters one at a time (one of my filter pages has 8 common filters created and saved)
2. Copy and paste the generated code into a web page like the following:(yours will look different depending upon your filters)


<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Common Filters</title>
</head>

<body>

<p>Click on the Filter button below to filter results. </p>
<form method="post" action="http://www.yourwebsite.ca/somefolder/yourtable_view.php">
<p>
<input name=FilterAnd[1] value='' type=hidden>
<input name=FilterField[1] value='19' type=hidden>
<input name=FilterOperator[1] value='like' type=hidden>
<input name=FilterValue[1] value='Fish Creek' type=hidden>

<input name=FilterAnd[2] value='' type=hidden>
<input name=FilterField[2] value='14' type=hidden>
<input name=FilterOperator[2] value='like' type=hidden>
<input name=FilterValue[2] value='2013' type=hidden>


<input type=submit value="Descriptive Name for Button">

</body>
</html>


3. Remove extra /body/html tags when copying/pasting the filter code generated by your appgini application.
4. Save the page as a html page with some name you like - your choice.
5. In the links-home.php file create a link to the file which should look like the following code. Please note I only allow the admin group to see this link on the home page but you can let whichever group you wish see the link.

$homeLinks[] = array(
'url' => 'http://www.yourwebsite/yourfolder/yourfile.html',
'title' => 'Filters for Records',
'description' => 'Some Premade Filters for Data',
'groups' => array('Admins''), // groups allowed to see this link, use '*' if you want to show the link to all groups
'tileClasses' => '', // optional CSS classes to apply to link block
'textClasses' => '' // optional CSS classes to apply to link description
//'icon' => 'path/to/icon' // optional icon to use with the link
);


Then, when those who are allowed to see the filters log in and are shown the home page they can see a square they can click on to take them to the filters page. Then they just click on the filter of their choice.

I, on the html page, put a brief description of what each button will show when clicked. When the button is clicked on it takes you to the correct table and shows the filtered results. Since you have to be logged in with the correct group to have the filters work there is no real worry about someone accessing the html page by itself and clicking on a button. The results will not be shown until they log in. If they access the page they will get an error message and then be taken to the login page.

Enjoy. Any questions just ask.

I also have a instance of a include php file which places the pre made filter buttons at the top of the page above the table to make it easy for the user to just click. Again these are only shown to those who log in as a member of select group(s). This solution is nicer but involves more code. The above solution is easier to implement but the one with the buttons above the table is nicer to use.

Coming in a future tip - how to use a table to log when a user logs in rather then just a text log file as shown on the appgini site (http://www.bigprof.com/appgini/help/adv ... obal-hooks. Little more user friendly than a text file and can be sorted etc. You then do not need to get the log file from your server. This is created in two places, when the appgini app is generated and by writing a hook. Also records those attempts which fail.

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

benzoD
Veteran Member
Posts: 69
Joined: 2013-01-31 21:16

Re: Show me the sorting!

Post by benzoD » 2013-03-26 15:05

shasta59, you are awesome. AWESOME.

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: Show me the sorting!

Post by KSan » 2013-04-14 21:51

Alan, thanks for sharing this very useful approach. I have a follow-on question if I may.

I have a simple list of events. I want to capture the Date and Time in separate fields as I like the Date picker offered by AppGini on Date fields. Since Date and Time are separate fields I can't present the table properly sorted (on Date and then Time) at get go. One option around this is to add a Date & Time field and maintain it via hooks and sort based on that. I would hide that field in the Table and Detail views. I know this approach would work but it would be yet another field in the DB and hook code to worry about etc.

Is there any way to save a Filter which contains all the sorting needed and then apply it by default each time the table is opened?

Thanks for your help. Most appreciated.

User avatar
dilitimor
Veteran Member
Posts: 31
Joined: 2013-01-10 02:45
Location: Jakarta, Indonesia
Contact:

Re: Show me the sorting!

Post by dilitimor » 2013-05-15 08:39

Alan, thanks for sharing, awesome.
Could you share us about an instance of include php file which place the pre made filter button at the top of page or above the table

thank you for your share

rgds
dilistior

bambinou
Veteran Member
Posts: 162
Joined: 2013-02-01 15:09

Re: Show me the sorting!

Post by bambinou » 2015-02-24 12:59

I am still not understanding why this app do not have a sort filter hook "easy to use" where we could change the "desc" or "asc" parameters per table field. I am lost on this....

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: Show me the sorting!

Post by shasta59 » 2015-02-24 17:04

I am using AppGini 5.31

There are apps out there which can do that for you but at a much much greater cost.

The value for money in AppGini is great.

That said take a look at this thread and what I am working on - it will do for me what I think you are requesting. AppGini, IMHO, was never meant to be all things to all people and is really a basic quick app making environment which allows you to customize the heck out of it such as I have done a lot of.

http://forums.appgini.com/phpbb/viewtop ... f=8&t=1510

This would allow me to do a lot of customization and I am also working on adding a lot of customization options for the end user as well. By being able to do this myself I get exactly what I want without paying for a lot of features I would never use. AppGini allows me to prototype very quickly and get something up and running in an hour rather than many many hours with some of the others and the cost is very affordable.

As Ahmad says on his web page:

AppGini helps you develop responsive web database applications instantly. You do not need to have any programming background to use it. Just define your database, set some options, click the Generate button, and you're done!

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: Show me the sorting!

Post by shasta59 » 2015-02-24 17:07

Re placing the button at the top.

If and when I get some time I will produce the code to show how to do it. Not hard but I am juggling too many balls in the air right now to even think about writing that code. But, it would be easy to do.

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

bambinou
Veteran Member
Posts: 162
Joined: 2013-02-01 15:09

Re: Show me the sorting!

Post by bambinou » 2015-02-24 17:34

Hi Alan,

Thank you for the reply.
When you say replacing the button at the top, do you mean the home screen?

I tried so many things today, I gave up, I cannot believe we cannot save filters(forever), this is really a big problem.

Thanks,

Ben

Post Reply