Disable all links in a table (tableview) row

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
jmcgov
Posts: 18
Joined: 2018-12-19 01:31

Disable all links in a table (tableview) row

Post by jmcgov » 2019-01-23 13:52

I thought I'd share this, as I find it handy and it took me a while to figure it out.

Three points first
- it may not be well done, as I'm not good on jquery
- I dont think it is secure, ie it does not prevent someone from opening the disabled link (if they chose to construct it)
- Credit to Ahmad, as it is based on his solution in this thread https://forums.appgini.com/phpbb/viewto ... f=7&t=1322

Problem: I have an app with
- a table, called p02_orders
- which has a filed Quantity
- for reasons (of no consequence), I want to prevent users from opening the detail view, if the Quantity=600
- I also want to colour code the table row

Solution:
- go to hooks p02_order
- go to function p02_orders_header
- between case 'tableview' and break, enter the code, below
- I could also hide the row, by adding class 'hide' instead of 'danger

Hope it helps someone :)

$header="<%%HEADER%%><script>
\$j(function(){
\$j('td.p02_orders-Quantity').each(function(){
if(\$j(this).text() == '600'){
\$j(this).parent().addClass('danger');
\$j('tr.danger a').each(function(){
\$j(this).addClass('btn disabled');
})
}
else{
\$j(this).parent().addClass('success');
}
})})</script>";

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

Re: Disable all links in a table (tableview) row

Post by a.gneady » 2019-01-24 13:51

Thanks for sharing, @jmcgov :)
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

:arrow: Summary Reports plugin enables you to build powerful reports and charts inside your AppGini application through a few simple steps. See the big picture and discover trends in your data that empower you to take the right decisions confidently.

:arrow: Search Page Maker enables you to build user-friendly yet powerful search pages for your AppGini application by simply dragging and dropping the fields you want to include in search.

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 378
Joined: 2018-04-01 10:12

Re: Disable all links in a table (tableview) row

Post by pböttcher » 2019-01-24 20:25

Hi,

just a suggestion. If you want you can also add to the detailview a check if your specific value for the ID passed matches your "dont show the details" (=600 in your sample), redirect the user to the tableview.

User avatar
jmcgov
Posts: 18
Joined: 2018-12-19 01:31

Re: Disable all links in a table (tableview) row

Post by jmcgov » 2019-01-29 13:13

Thanks pböttcher

Post Reply