How to Sort Two Fields?

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
mohamed
Veteran Member
Posts: 80
Joined: 2020-04-19 16:18

How to Sort Two Fields?

Post by mohamed » 2023-05-24 11:30

Hello,

in AppGini I am allowed/able to Sort a Single Field per table using the "Default Sort By" option.

Is there a way to Sort on two (2) Fields/Columns ?


THANK YOU
THANK YOU...
AppGini Pro 24.11 -
Calendar - Search Page Maker - Summary Reports - Mass Update - DataTalk -
bizzworxx AppGini Helper JabaScript Library - bizzworxx Inline Detail-View - bizzworxx Helper Pack - AppGini Helper Packaging Tool -
Udemy course

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: How to Sort Two Fields?

Post by jsetzer » 2023-05-24 13:21

Check out DefaultSortField property of $options in TABLENAME_init hook

Docs:
https://bigprof.com/appgini/help/advanc ... ist-object
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

mohamed
Veteran Member
Posts: 80
Joined: 2020-04-19 16:18

Re: How to Sort Two Fields?

Post by mohamed » 2023-05-24 19:28

Thanks JAN,

I am able now to do the sorting (following two links in the Forum - forgot the links :(

that I have to do the following two steps:

1. Set Default Sort by to None in the Table using AppGini app

2. edit the TableName.PHP file and Configure the function TableName_init

Code: Select all

	function  TableName_init(&$options, $memberInfo, &$args) {

		$options->DefaultSortField = '4 asc, 5 asc';
		$options->DefaultSortDirection = '';

		return TRUE;
	}

Is there documentation of $Options ?


Thanks again..
THANK YOU...
AppGini Pro 24.11 -
Calendar - Search Page Maker - Summary Reports - Mass Update - DataTalk -
bizzworxx AppGini Helper JabaScript Library - bizzworxx Inline Detail-View - bizzworxx Helper Pack - AppGini Helper Packaging Tool -
Udemy course

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: How to Sort Two Fields?

Post by jsetzer » 2023-05-24 19:53

Is there documentation of $Options ?
Yes, see the link I've given above.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: How to Sort Two Fields?

Post by jsetzer » 2023-05-24 19:56

$options->DefaultSortField = '4 asc, 5 asc';
I think you can also use fully qualified column names like this:

Code: Select all

$options->DefaultSortField = 'tablename.column_x DESC, tablename.column_y';
May be easier to read and easier to maintain when changing order of fields.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

mohamed
Veteran Member
Posts: 80
Joined: 2020-04-19 16:18

Re: How to Sort Two Fields?

Post by mohamed » 2023-05-25 17:35

Hi Jan,

Cool .. THANK YOU big time ..

Regards..
THANK YOU...
AppGini Pro 24.11 -
Calendar - Search Page Maker - Summary Reports - Mass Update - DataTalk -
bizzworxx AppGini Helper JabaScript Library - bizzworxx Inline Detail-View - bizzworxx Helper Pack - AppGini Helper Packaging Tool -
Udemy course

Post Reply