Keep Table Group Expanded at the Startup(to be controlled by user)

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
skumar
Posts: 5
Joined: 2018-11-14 17:50

Keep Table Group Expanded at the Startup(to be controlled by user)

Post by skumar » 2018-12-05 16:24

Hi,
Pls refer the screen shot; I want to control the Table Expanded or Not at the Startup of Home Page Load based on on the Check box Status(check box status will be stored in database). Kindly help me in coding.
check box.png
check box.png (102.81 KiB) Viewed 2226 times
Regards,
SAMPATH

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Keep Table Group Expanded at the Startup(to be controlled by user)

Post by pbottcher » 2018-12-09 15:06

Hi,

you can try to add this to your hooks/footer-extras.php. Note, this is no full code, only the idea

## get the "keep Expanded" Checkbox status for your tablegroup.

KeepExpanded = value of checkbox for LABEL

If (KeepExpanded == 1) // Keep Expanded checkbox is checked
{
$j('a:contains("LABEL")').click();
}

Where LABEL would be MBBS ACADEMIC ACCOUNTS according to your screenshot.

Hope that helps.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

skumar
Posts: 5
Joined: 2018-11-14 17:50

Re: Keep Table Group Expanded at the Startup(to be controlled by user)

Post by skumar » 2018-12-10 15:56

Thank u for your replay.
But how to place the "keep Expanded" Checkbox at that location?
Regards,
SAMPATH

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Keep Table Group Expanded at the Startup(to be controlled by user)

Post by a.gneady » 2019-01-09 14:05

Hmm ... you can use hooks/footer-extras.php to inject any element into any page using JavaScript. The general idea is to find a suitable selector in the page, using the inspector of your browser, and then insert your element inside/after/before that selector. So, for this example, every table link in the homepage has an id like "tablename-tile" ... So, you could inject the checkbox after "Uncleared transactions" panel like this (code in footer-extras.php):

Code: Select all

<script>$j(function() {
    $j('#uncleared_transactions-tile').after('<input type="checkbox"> Keep expanded');
})</script>
The above is a basic example you can expand on ... I assumed the table name is uncleared_transactions.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply