Show Different RecordsPerPage For Different Devices

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
rngoda
Veteran Member
Posts: 139
Joined: 2020-02-05 16:00
Location: KENYA
Contact:

Show Different RecordsPerPage For Different Devices

Post by rngoda » 2024-03-12 13:08

Hello, this modification will enable you to show different RecordsPerPage depending on the user device Mobile or non-mobile devices.
So in our example, I want to show 50 records when the user is using a mobile and 100 when using a computer or laptop
  • First step go to the hooks folder
  • Find your tablename.php - table name is the name of the actual table file you are looking for
  • Inside the tablename_init function just above return TRUE add this code

Code: Select all

//detect user device type
	$isMobile = (bool) strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile');
	$options->RecordsPerPage = $isMobile ? 50 : 100;
That is it. Now you can modify the numbers to your preference
I'm a software engineer specializing in web database application development for complex scalable web apps.

Buy AdminLTE Plugin For Appgini: HERE
Buy Cloud Storage Plugin For Appgini HERE

Checkout AdminLTE Plugin For Appgini Tutorials On Youtube

For support Email: [email protected] Whatsappp: Me Here

Post Reply