This topic is locked
[SOLVED]

Additional Order by Options

8/12/2021 9:54:03 PM
PHPRunner General questions
D
DRCR Dev author

Hi

Is there a quick way, like we have the additional where statements which create pretty tabs, is there a quick way to create tabs with additional ORDER by statements.

I thought of creating additional pages, but I cant use the $strOrderBy as it would be the same for every additional page.

This is for a mobile user experience. The built in sort by click buttons at the top are great in desktop, but I want to use the mobile version as an HTML5 mobile app and am trying to mimic the "App experience" as much as possible.

I love the look of the built in tabs and they blend beautifully in ioS and Android.

-Cec

A
acpan 8/13/2021

Maybe use the list page url's param and at Before SQL event, apply $strOrderBy conditionally:

First, set the Additional Where tab's name to "A" and "B" respectively, then at Before SQL event:

if ( $_GET["tab] == "A" )
{
$strOrderBy = " ORDER BY fieldname1 ASC ";
} else if ( $_GET["tab] == "B" )
{
$strOrderBy = " ORDER BY fieldname2 DESC ";
}

P.S. I have not tried the above , do verify your own.

Edit:

I thought of creating additional pages, but I cant use the $strOrderBy as it would be the same for very additional page.

You actually can, just copy a page, and name it as eg. mobile.

Then use: if ($_REQUEST["page"] == "mobile" ) at before SQL event and apply the sort order conditionally.

HJB 8/13/2021

Sort by dropdown control

In LIST PAGE SETTINGS you can activate "sort by dropdown control" which is useful in MOBILE mode.
View screenshot #6 under above URL content for further details ...

D
DRCR Dev author 8/13/2021

thanks! I've not used extra pages for this project cause I thought It wasnt possible. If I knew this sooner, I would have done so many things differently.

I will test all of these. As I'm learning I'm building a repo of code examples for future projects. Every problem solves solves so many others.

Appreaciate the advice.

-Cec

HJB 8/13/2021

Dynamic Tabs - Youtube Tutorial

... for inspiration purposes only ...

D
DRCR Dev author 8/14/2021

Thanks so much. This code is excellent.I can use it for so many things and it makes working with pages so easy. Instead of views, I can make additional pages and it saves time when I update. IN the past I was having to update various different sections, now I update one and they all update. This is my first project and it's got lots of wierd stuff. I've learned so much and am excited to improve my software.