Peculiarities about template()
Peculiarities about template()
I am already using a custom template for the editor form. But I need to change it for different actions. Right now, I am using template
to set it initially and it works perfectly fine. But when it comes to use template()
, it breaks.
Here are the peculiarities;
1- If you set template
in the init options of the editor, then trying to change it later like editor.template('#template);
will cause editor remove the template all together opening an empty dialog.
2- If you remove the template
from init options, then you can use template()
to set your custom template. But this time it works only once. If you open the editor form for the second time, again an empty dialog is what you get.
What could be I am doing wrong? What I need to do is, set a default custom template and later change it with a custom button.
This question has an accepted answers - jump to answer
Answers
Maybe this statement from the
template()
docs describes the problems you are seeing:Kevin
I guess you are right, but I think the document is not clear enough about "how to reuse". See this example: http://live.datatables.net/lehojixi/1/edit
I wrote custom action for the edit button just to reset the template to default. It is obvious that I am not properly "reusing" it. As I said, it's not clear how to reuse.
Here is one option:
http://live.datatables.net/lehojixi/2/edit
It stores the templates into variables and uses the variables to display them.
Kevin