externalData

allows defining custom 'move' logic for the component.

function externalData;

Example

var dtable = {
    view:"datatable",
    // datatable config
    drag:true,
    externalData: function (data, id){
        data.rank = data.rank || -1;
        data.title = data.title || data.value;
        return data;
    }
};

Related samples

Details

The property function takes 3 parameters:

  • newdata - (object) the data item to move;
  • id - (string) the item id in the source element;
  • data - (object) original data of the moved data item.

The function is called when a data item is about to be moved to the target component.

When you drag a data item to another component, it preserves its id, unless the target component contains an item with such an id. Then the item will receive a random id. The changed item is newdata. The second parameter, id, stores the initial id of the item and data stores the initial data object.

See also
Back to top
If you have not checked yet, be sure to visit site of our main product Webix js frameworks and page of javascript context menu product.