disable row editing if a field is equal to....

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
G Belgrado
Veteran Member
Posts: 61
Joined: 2017-03-12 09:24

disable row editing if a field is equal to....

Post by G Belgrado » 2019-04-08 14:29

In table view
I would like to create a function to disable line editing
if a field contains a certain value

TABLE_1
if field_2 = "closed"
disable editing of the whole row.
The detail view can only be opened as a print preview

Can someone help me?

thanks

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

Re: disable row editing if a field is equal to....

Post by pbottcher » 2019-04-08 21:37

Hi,

you can try this:

$j('td.TABLE-FIELD :contains({VALUE})').parent().find('a').each(function () { $j(this).removeAttr("onclick").removeAttr("href") } )

Where you replace TABLE, FIELD and VALUE according to your needs
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.

G Belgrado
Veteran Member
Posts: 61
Joined: 2017-03-12 09:24

Re: disable row editing if a field is equal to....

Post by G Belgrado » 2019-04-09 08:30

Hi pböttcher,
First of all, thank you for your time

Does not work

the table is "Richieste" and the field is "stato_rich"

I created the "Richieste-tv.js" file in the hooks folder
and I entered:

Code: Select all

$j(function() { 
$j("td.Richieste-stato_rich :contains('In Attesa')").parent().find("a").each(function () { $j(this).removeAttr("onclick").removeAttr("href") } );

$j( "td.Richieste-stato_rich:contains('In Attesa')" ).css( "text-decoration", "underline" );
});
the second $j() it works

G Belgrado
Veteran Member
Posts: 61
Joined: 2017-03-12 09:24

Re: disable row editing if a field is equal to....

Post by G Belgrado » 2019-04-09 08:45

I'm sorry
was the space between stato_rich and colon
now works

thanks again

sjohn
Veteran Member
Posts: 86
Joined: 2018-05-23 09:32

Re: disable row editing if a field is equal to....

Post by sjohn » 2019-04-10 09:33

I have a question to this :

Should also not something be done in the detail-view?

I guess that mouse (left) click is disabled if record contains a certain value. But what if user right-click and then "pick" the link-address/URL, and opens this in a new tab - will the user then not see the detail view?

G Belgrado
Veteran Member
Posts: 61
Joined: 2017-03-12 09:24

Re: disable row editing if a field is equal to....

Post by G Belgrado » 2019-04-10 10:31

nothing is happening
disabling "href"
the links of the whole row become normal text

G Belgrado
Veteran Member
Posts: 61
Joined: 2017-03-12 09:24

Re: disable row editing if a field is equal to....

Post by G Belgrado » 2019-04-10 10:42

only by manually changing the ID
in " ....table_view.php?SelectedID= "
With the ID of the disabled row you can open the details page....

but this could only be done by a very skilled user ...
this is not the case for my users .. :mrgreen: :mrgreen:

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

Re: disable row editing if a field is equal to....

Post by pbottcher » 2019-04-10 11:34

Hi,
yes of course, but this was not part of the question :-)

If you want to disable the DV for a particular setting, you can do this as well via the hooks
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.

Post Reply