Dynamically create components

21 views
Skip to first unread message

MP

unread,
Jul 10, 2014, 2:23:20 PM7/10/14
to mont...@googlegroups.com
How would one go about dynamically instantiating Montage components at runtime?  Would it be possible to supply some sample code for, as an example, adding a button to the layout entirely through JavaScript code at runtime when its size, position, label, parent, bindings, event listeners, and other properties are not known at design time?  (Or provide a link to a tutorial that shows this; I was unable to find one.)  Thanks!

afo...@montagestudio.com

unread,
Jul 10, 2014, 4:42:27 PM7/10/14
to mont...@googlegroups.com
Hi,

We're still trying to come up with an easier API to dynamically create and add components to the component tree.
Having said that, you can still do it by mimicking what montage does with the component declaration. Here's an example of adding a button: http://montagejs.github.io/mfiddle/#!/1ab62c2d5c02389e0ac1

MP

unread,
Jul 11, 2014, 2:28:30 PM7/11/14
to mont...@googlegroups.com
Great, thanks!
Reply all
Reply to author
Forward
0 new messages