Dynamic editor form based on select?
Dynamic editor form based on select?
Apologies if this question is a duplicate - I searched around and couldn't find a solution, but perhaps my searching wasn't optimal. Anyway, I have a page that has an editor, which has a just a couple of fields:
editor = new $.fn.dataTable.Editor({
fields: [{
type:"select", label:"Test", name:"test",
options: [
{label:"Option 1", value:"opt1"},
{label:"Option 2", value:"opt2"}]
}]});
What I want is to add other fields to the editor based on selection of Option 1 / Option 2. I suspect the solution for this is to have an event that fires when the "test" selection is made - but not sure a) how to wire up that event and b) how to create different forms - I think I would have to create some templates for each option, but again not sure.
Thanks!
Andy
This question has an accepted answers - jump to answer
Answers
Hi Andy,
Have a look at this example which sounds like it is what you are looking for.
Allan
Perfect! Thanks!