copy
copies an item to the same or another object
function copy( // the id of the copied object sid: id, // the index of the copy tindex: number, // the object that an item is copied to tobj?: WebixDataMoveTarget, // extra parameters for copying details?: WebixDataMoveOptions): void
Example
Section titled “Example”gridb.attachEvent("onBeforeDrop", function(context, ev){ for (var i=0; i< context.source.length; i++){ context.from.copy(context.source[i],context.index,this,{newId:webix.uid()}); } return false;});
also check the next samples:
Details
Section titled “Details”In the sample above:
- sid is the ID of each dragged item;
- tindex is the index of a copy;
- tobj is a datagrid object where the items are dropped to;
- newId is generated automatically with the webix.uid() method.
The details object can contain the following properties:
details = {};details.newId = "123"; // a new id for the moved item
Note that in case newId is not defined, the new ID will be the same as the ID of the source item (sid), which is not desirable while copying takes place within one and the same component.
See also
Section titled “See also”Articles