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>";
Disable all links in a table (tableview) row
Re: Disable all links in a table (tableview) row
Thanks for sharing, @jmcgov
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.
Re: Disable all links in a table (tableview) row
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.
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.
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.
Re: Disable all links in a table (tableview) row
Thanks pböttcher