Editor insert only "datatable" field
Editor insert only "datatable" field
unibocconi-ltcc
Posts: 14Questions: 4Answers: 0
Hi,
I have a "datatable" field that I want to make it configurable only on insert.
On the server side I've already blocked the "update" action with ->set(Field::SET_CREATE)
, but I was wondering if there is a way also to prevent the change on the frontend.
This question has an accepted answers - jump to answer
Answers
Yes, similar to the other field types,
datatable
can be enabled and disabled (field().enable()
andfield().disable()
).Combine those two method with the
initCreate
andinitEdit
events and you can enable and disable the field as needed - e.g.:Allan
This example from this thread is doing something similar to what you want. It's using
field().enable()
to make theage
field editable on creation, but read-only afterwards.Is that what you were after? Or did you want the field to not appear on the form? If so, you could use
field().hide()
instead for that.Colin
Thank you all for the suggestions and hints!
The type "datatable", when disabled, can however be searched and the pagination is active. I found this confusing.
So I came up with the approach of creating a new field and then show it an populate it when needed:
Sounds like a nice solution
Allan