copy()

Creates a copy of a Widget instance.

The copy has all the attributes of the original widget including its widgets. Its attributes can be accessed only after it has been stored in a widgetlist attribute of an Obj or Widget since initially the copy is not contained in such an attribute.

Returns

Widget – a copy of the widget

Example

Copy a widget contained in a widgetlist and append it to this list:

Copy
obj = Scrivito.Obj.root();
widgetlist = obj.get("body");
widget2 = widgetlist[0].copy();
widgetlist.push(widget2);
obj.update({body: widgetlist});