Noob: Change field attr
Noob: Change field attr
Error messages shown:
None.
Description of problem:
I have an embarrassing newbie question.
How does one remove attributes on an Editor field.
I have a field defined as
{label: 'Company Code:', name: 'id', type: 'readonly', attr: {disabled: true, required: true}},
Editor, being a very efficient and faithful servant is not letting me touch that field when addin data.
So I thought I'd add an event handler...
editor.on('initCreate', function (e, json, data) {
editor.field('id') // <=== I don't know what to put here to remove type: 'readonly', attr: {disabled: true, required: true}
});
Your feedback is appreciated.
This question has an accepted answers - jump to answer
Answers
That doesn't sound like that! To get to that problem you need to have done a couple of things with Editor, I guess
I don't think you can actually change many Editor attributes later on, but you can always remove and add fields dynamically. ( Here is a link to an attribute - the options - that you can change, but not for the selectize field below: https://editor.datatables.net/reference/api/field().update() )
Here is an example in which I read the options dynamically from the server and then "clear" an existing field and "add" it back again in its position of "ctr.label_text_3".
https://editor.datatables.net/reference/api/clear()
https://editor.datatables.net/reference/api/add()
Thank you:)
That pointer worked.
I couldn't find a way to target the field I wanted to remove, so, I used a big hammer because I only have three fields case. I need to learn how to target specific fields when there are more than five (5) fields. I know the information is in there somewhere because Editor documentation is very rich, and top notch... I just need to find it.
It worked! I really need to understand Editor better.
Thank you for the help.