Page 1 of 1
RecordsPerPage for child table
Posted: 2017-04-05 07:26
by Yilmaz
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
Re: RecordsPerPage for child table
Posted: 2017-04-21 08:46
by Yilmaz
Dear all,
anyone an idea or hint for me??
KR
Yilmaz
Re: RecordsPerPage for child table
Posted: 2017-07-19 13:13
by a.gneady
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.
Re: RecordsPerPage for child table
Posted: 2022-02-19 10:04
by SkayyHH
Hi, is there also an idea to do this via a hook?
Many thanks.
Re: RecordsPerPage for child table
Posted: 2022-02-19 10:58
by pbottcher
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.
Re: RecordsPerPage for child table
Posted: 2022-02-19 13:02
by SkayyHH
OK. thank you very much!
Re: RecordsPerPage for child table
Posted: 2024-02-08 18:49
by rpierce
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
Re: RecordsPerPage for child table
Posted: 2024-02-08 18:56
by jsetzer
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.
Re: RecordsPerPage for child table
Posted: 2024-02-08 19:27
by rpierce
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) {
}
Re: RecordsPerPage for child table
Posted: 2024-02-09 05:02
by jsetzer
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 (135.79 KiB) Viewed 458 times
There is a
$config
-variable, passed by reference (
&$config
) which you can modify according to your needs.
Re: RecordsPerPage for child table
Posted: 2024-02-28 22:38
by rpierce
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.
Re: RecordsPerPage for child table
Posted: 2024-02-29 06:37
by jsetzer
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.
Re: RecordsPerPage for child table
Posted: 2024-02-29 08:00
by zibrahim
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.
Re: RecordsPerPage for child table
Posted: 2024-02-29 18:24
by rpierce
Thank you! I will try this.