Editor: Universally disable editing based on condition
Editor: Universally disable editing based on condition
How might I prevent editing if a certain value (locked) is set to true?
I have 5 DataTable instances, and 5 associated Editor instances.
The 1st table/editor set has a field called "Locked". If this is set to true, I don't want ANY of the dependent entries in the corresponding 4 tables + 4 editors to be modified... just viewed only.
I'm thinking of creating a "global" variable in the application named "locked", and then maybe using readonly
on all the fields, somehow.
Is there a way to universally disable editing on an Editor instance based on some condition?
Should I create my own function that accepts a DTE instance name, and maybe this function could get all the instance's field names, and disables them all, or something...
Something Like... dteInstanceName.field( '[ALL FIELDS]' ).disable();
This question has an accepted answers - jump to answer
Answers
Hi @raydlevel5 ,
You could have that test in the
preOpen
event. If that event handler returnsfalse
, then the event is cancelled, effectively making the table read-only.Cheers,
Colin
I should have mentioned that I still want to Editor form to open... for viewing only...
Ah, yep, then I think you're right, you'll need to add the readonly to the fields. I imagine in that
preOpen
, you would do your test - and either add the fields to the form withreadonly
or not, depending on the result.C