Page 1 of 1

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

Posted: 2018-12-05 16:24
by skumar
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 2243 times

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

Posted: 2018-12-09 15:06
by pbottcher
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.

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

Posted: 2018-12-10 15:56
by skumar
Thank u for your replay.
But how to place the "keep Expanded" Checkbox at that location?

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

Posted: 2019-01-09 14:05
by a.gneady
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.