Hi there,
Anyone knows how to use this child_records_config function in the __global hooks?
I want to change the number of records in the child table from the default 10 to 20.
I understand that this function is newly added in 22.14
Appreciate if someone can share the syntax as I couldn't find it in the forum or the appgini website.
Thanks.
function child_records_config
function child_records_config
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: function child_records_config
Hi Zibrahim,
Take a look at this link:
https://bigprof.com/appgini/help/advanc ... rds_config
I do not think it will help changing 10 to 20, might be wrong though.
Take a look at this link:
https://bigprof.com/appgini/help/advanc ... rds_config
I do not think it will help changing 10 to 20, might be wrong though.
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper
Re: function child_records_config
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper
Re: function child_records_config
Hi Zibrahim, sure you can:
Code: Select all
function child_records_config($childTable, $childLookupField, &$config)
{
$rpp = 20;
array_walk($config, function (&$t) use($rpp) { array_walk($t, function (&$cn) use($rpp) { $cn["records-per-page"] = $rpp; }); });
}
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<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 readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: function child_records_config
Thanks Jan. It works flawlessly!
I believe it is not as straight forward like the init function, right?
Need to figure out how to set some parent and child table combinations with the specific records per page value...
Thanks again.
I believe it is not as straight forward like the init function, right?
Need to figure out how to set some parent and child table combinations with the specific records per page value...
Thanks again.
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: function child_records_config
It is straight forward.
You can modify the code above and do changes for certain tables/fields, only.
$config
contains settings for all tables, not just for one table (as in hooks/TABLENAME.php
/ TABLENAME_init(...)
-function). You can modify the code above and do changes for certain tables/fields, only.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<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 readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: function child_records_config
Code: Select all
function child_records_config($childTable, $childLookupField, &$config)
{
// example:
// partners.id <---- contacts.partner_id
changeRecordsPerPage($config, "contacts", "partner_id", "partners", 1);
}
Code: Select all
function changeRecordsPerPage(&$config, $tn, $cn, $parentTn, $recordsPerPage = 20)
{
$cfg = $config[$tn][$cn];
if (!$cfg) die("Not found: {$tn}.{$cn}");
if ($cfg["parent-table"] != $parentTn) die("Parent table mismatch");
$config[$tn][$cn]["records-per-page"] = max(1, $recordsPerPage);
}
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<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 readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: function child_records_config
Thank you very much Jan !!
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.