Reuse editor inside another form
Reuse editor inside another form
Hello
In my project there is a central editor for working on booking items.
In these items there is a link to an address.
Outside the booking editor I have another editor for dealing the addresss.
I want to be able to edit an address inside the booking form so the user does not have to leave it.
As there are lots of fields and lookups in the address I do not want to create a simple source code copy.
I allready created a display controller which shows another editor inside the booking editor. This works generally well.
I could even put the address fields in an array inside the address function and export it to the booking form.
But I also have to call some functions inside the address context for example initialising the lookups etc.
It would be great to change the display init value of an existing editor instance, regarding to the context the editor is opened in. But that seems not possible.
Does anyone have some idea?
Regards
Christian
Answers
Hi Christian,
Unfortunately, what you are looking for is not currently possible with Editor. It is something we are planning to look at in future, but at the moment, the closest would be to close the previous Editor form and start a new one for display for the sub-item. But that causes the previous data to be lost...
Another possibility might be something like that presented in this blog post.
Allan
Hi Allan,
thank you for the quick reply.
I found a way to handle it nearly to what I was looking for.
My solution is to create the Editor in a function and give some options to that function which have to be merged to the standard options like fields etc.
This way it is possible to at least reuse the code if not the instance.
For using the editor with the table I use { table:.... , idSrc:.... } as options and for using it inside the other modal I use a different display controller that is { display:... } in the options.
This way I do not have to copy the code.
I will post an example next week when I have a bit more time.
Regards,
Christian
Sounds good - thanks. I look forward to seeing your solution.
Allan