AppGini 24.15

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
Marcelo Vitoria
Veteran Member
Posts: 79
Joined: 2016-10-11 12:08

AppGini 24.15

Post by Marcelo Vitoria » 2024-07-04 22:52

Appgini 24.15:
To override the default records per page options, set AppGini.config.recordsPerPageOptions as an array of integers in hooks/header-extras.php or hooks/footer-extras.php.
Could someone teach me how to do this?

Thanks
Marcelo Vitoria
Coding since 1982 ! :geek:
Basic Sinclar - Clipper - Visual Foxpro - VB6 - PHP
AppGini 24.17 - AdminLTE - SPM
https://www.workspaceservices.com.br

fdissait
Posts: 25
Joined: 2019-07-24 07:57

Re: AppGini 24.15

Post by fdissait » 2024-07-06 14:56

Hello
The way I founded (bad) was to edit common.js

AppGini.renderTVRecordsPerPageSelector = () => {
// if not TV, return
if(!AppGini.currentViewIs('TV')) return;

// if records per page selector already rendered, return
if($j('#records-per-page-selector').length) return;

// to override the default records per page options,
// set AppGini.config.recordsPerPageOptions as an array of integers
// in hooks/header-extras.php or hooks/footer-extras.php
let rppOptions = [5, 10, 20, 30, 40, 50, 100, 200];
if(AppGini.config.recordsPerPageOptions) {
rppOptions = AppGini.config.recordsPerPageOptions;
}

and edit let rppOptions according to my choice : let rppOptions = [5, 10, 15, 30, 50];

Editing hooks/header-extras.php
like this :
<script>
// to set an array of 5,10,15,30,50 records
let AppGini.config.recordsPerPageOptions = [5, 10, 15, 30, 50];
</script>
has no effect.
François

User avatar
Marcelo Vitoria
Veteran Member
Posts: 79
Joined: 2016-10-11 12:08

Re: AppGini 24.15

Post by Marcelo Vitoria » 2024-07-08 19:30

fdissait wrote:
2024-07-06 14:56
Hello
The way I founded (bad) was to edit common.js

AppGini.renderTVRecordsPerPageSelector = () => {
// if not TV, return
if(!AppGini.currentViewIs('TV')) return;

// if records per page selector already rendered, return
if($j('#records-per-page-selector').length) return;

// to override the default records per page options,
// set AppGini.config.recordsPerPageOptions as an array of integers
// in hooks/header-extras.php or hooks/footer-extras.php
let rppOptions = [5, 10, 20, 30, 40, 50, 100, 200];
if(AppGini.config.recordsPerPageOptions) {
rppOptions = AppGini.config.recordsPerPageOptions;
}

and edit let rppOptions according to my choice : let rppOptions = [5, 10, 15, 30, 50];

Editing hooks/header-extras.php
like this :
<script>
// to set an array of 5,10,15,30,50 records
let AppGini.config.recordsPerPageOptions = [5, 10, 15, 30, 50];
</script>
has no effect.
François
Thanks for the help, but I think there should be a checkbox in the Appgini IDE to enable or disable the option.

I'll try to adjust my code and post the result here.
Marcelo Vitoria
Coding since 1982 ! :geek:
Basic Sinclar - Clipper - Visual Foxpro - VB6 - PHP
AppGini 24.17 - AdminLTE - SPM
https://www.workspaceservices.com.br

Post Reply