Page 1 of 1
AppGini 24.15
Posted: 2024-07-04 22:52
by Marcelo Vitoria
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
Re: AppGini 24.15
Posted: 2024-07-06 14:56
by fdissait
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
Re: AppGini 24.15
Posted: 2024-07-08 19:30
by Marcelo Vitoria
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.