Disable all links in a table (tableview) row
Posted: 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>";
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>";