RecordsPerPage for child table

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
Yilmaz
Veteran Member
Posts: 32
Joined: 2013-01-24 16:58

RecordsPerPage for child table

Post by Yilmaz » 2017-04-05 07:26

Dear all,

the way(s) how to modify the number of "records per page" for a "PARENT-table" is clear for me in AppGini 5.60:

1. Open the axp file > click on your table and modify the field "Records per page" from default value 10 to X
or
2. Go to datalist.php > find "function DataList()" > modify the line $this->RecordsPerPage = 10;

BUT: I would like to modify the number of "Records per Page" for a "CHILD table" below the parent table.

Unfortunately I could not find any php file where to modify this default value from 10 to X??

Any idea / hint for me?

KR
Yilmaz

Yilmaz
Veteran Member
Posts: 32
Joined: 2013-01-24 16:58

Re: RecordsPerPage for child table

Post by Yilmaz » 2017-04-21 08:46

Dear all,

anyone an idea or hint for me??

KR
Yilmaz

User avatar
a.gneady
Site Admin
Posts: 1314
Joined: 2012-09-27 14:46
Contact:

Re: RecordsPerPage for child table

Post by a.gneady » 2017-07-19 13:13

You can do this by editing the generated "parent-children..php" file .. Look for lines containing "records-per-page" and change the value in there.
:idea: AppGini plugins to add more power to your apps:

SkayyHH
Veteran Member
Posts: 459
Joined: 2015-04-27 21:18

Re: RecordsPerPage for child table

Post by SkayyHH » 2022-02-19 10:04

Hi, is there also an idea to do this via a hook?

Many thanks.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1665
Joined: 2018-04-01 10:12

Re: RecordsPerPage for child table

Post by pbottcher » 2022-02-19 10:58

Hi,

there is currently no option to do this via a hook. You need either to change the orginial parent-children.php, or write your own logic to handle the modification.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

SkayyHH
Veteran Member
Posts: 459
Joined: 2015-04-27 21:18

Re: RecordsPerPage for child table

Post by SkayyHH » 2022-02-19 13:02

OK. thank you very much!

rpierce
Veteran Member
Posts: 266
Joined: 2018-11-26 13:55
Location: Washington State

Re: RecordsPerPage for child table

Post by rpierce » 2024-02-08 18:49

I am using AppGini version 23.17 revision 1557.

In the past versions of AppGini, I have been able to change the number of child records per page by editing the "parent-children.php" file. Now when I open that file there is a message saying /* Parent/children config array has moved to incCommon.php#getLookupFields() */. I cannot find where to make the change in the "incCommon.php" file.

Can someone help me?

Ray

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

Re: RecordsPerPage for child table

Post by jsetzer » 2024-02-08 18:56

As a starting point:
Check out hooks/_global.php. there is a new hook function for a while now for configuring a lot of stuff (almost everything I think) related to child-tables.
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.14 Revision 1665 + all AppGini Helper tools

rpierce
Veteran Member
Posts: 266
Joined: 2018-11-26 13:55
Location: Washington State

Re: RecordsPerPage for child table

Post by rpierce » 2024-02-08 19:27

Hi Jan,

When I open the _global.php hooks file, I don't find any reference to child records:

Code: Select all

<?php
	// For help on using hooks, please refer to https://bigprof.com/appgini/help/working-with-generated-web-database-application/hooks

	function login_ok($memberInfo, &$args) {

		return '';
	}

	function login_failed($attempt, &$args) {

	}

	function member_activity($memberInfo, $activity, &$args) {
		switch($activity) {
			case 'pending':
				break;

			case 'automatic':
				break;

			case 'profile':
				break;

			case 'password':
				break;

		}
	}
Also, I don't know what I would put in there to modify the records-per-page of the subject table.

Thank you for helping!
Ray

	function sendmail_handler(&$pm) {

	}

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

Re: RecordsPerPage for child table

Post by jsetzer » 2024-02-09 05:02

If function child_records_config does not exist in hooks/__global.php, add this:

Code: Select all

function child_records_config($childTable, $childLookupField, &$config)
{
	if (getLoggedAdmin()) {
		$prop = function ($name, $value) {
			echo "<dt>{$name}</dt><dd><pre>". print_r($value,true) ."</pre></dd>";
		};
		echo '<h3>Help for customizing child records</h3>';
		echo '<dl>';
		$prop('file', "hooks/__global.php");
		$prop('function', 'child_records_config($childTable, $childLookupField, &$config)');
		$prop('$childTable', $childTable);
		$prop('$childLookupField', $childLookupField);
		$prop('$config', $config);
		echo '</dl>';
	}
}
Then open a detail view, having child records and see the output.

chrome_WYFm1NUpYG.png
chrome_WYFm1NUpYG.png (135.79 KiB) Viewed 1270 times

There is a $config-variable, passed by reference (&$config) which you can modify according to your needs.
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.14 Revision 1665 + all AppGini Helper tools

rpierce
Veteran Member
Posts: 266
Joined: 2018-11-26 13:55
Location: Washington State

Re: RecordsPerPage for child table

Post by rpierce » 2024-02-28 22:38

Hi Jan,

I added the code you provided to the _global.php and viewed the output that appeared in the child tables. Now my question is how do I modify that output? Do I need to copy and paste it into the _global.php file? It is uneditable in the output on the screen.

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

Re: RecordsPerPage for child table

Post by jsetzer » 2024-02-29 06:37

Hi,

the code above is just for showing the new hook-function child_records_config in hooks/__global.php and the configuration variables $childTable, $childLookupField and especially &$config which you can use for modifying many options.

Using the code above, check the contents of $config and see if there are useful options for your specific needs. Then just keep the following code and change $config according to our needs.

Code: Select all

function child_records_config($childTable, $childLookupField, &$config)
{
  // change $config variable according to your needs
}
As I don't have too much time now, maybe someone else can jump in and elaborate a solution for your specific needs. If not, feel free to contact me by email ([email protected]) for further assistence.
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.14 Revision 1665 + all AppGini Helper tools

User avatar
zibrahim
Veteran Member
Posts: 154
Joined: 2020-01-28 18:30
Location: Malaysia

Re: RecordsPerPage for child table

Post by zibrahim » 2024-02-29 08:00

Hello,
I use the following code to control the number of children's RecordsPerPage to appear under the parent DV.
This code location is in hooks/__global.php

Code: Select all

function child_records_config($childTable, $childLookupField, &$config) {
	$config['invoice_item']['invoice_id']['records-per-page'] = 20;
}
invoice_item : child table name
invoice_id : the field name of the lookup field which linking to the parent table
in my case, I specify 20 records per page.

This will only work for version 22.14 onwards.
Zala.
Appgini 24.17, MacOS 14.6 Windows 11 on Parallels.

rpierce
Veteran Member
Posts: 266
Joined: 2018-11-26 13:55
Location: Washington State

Re: RecordsPerPage for child table

Post by rpierce » 2024-02-29 18:24

Thank you! I will try this.

Post Reply