Amarillo Amarillo - 1 year ago 117
HTML Question

How to add a drop area to the text input?

I'm trying to implement DnD from the datatable to the Webix text input.
Actually, I found a sample for an html input:

webix.DragControl.addDrop("mytext", { // "mytext" is a DIV id
$drop:function(source, target, event){
var dnd = webix.DragControl.getContext();
target.value = dnd.from.getItem(dnd.source[0]).title;

But how can I addDrop to a Webix ui.text instead? is it possible to replace the DIV id with something?
The point is that the ID of the inner input is dynamic (stored until you reload the page), so I don't see any easy to understand method to add drop area to it. Any ideas are appreciated.

Here's a demo based on the previous sample:

Answer Source

A dirty solution is to addDrop to webix widget $view property (= DOM Element):

webix.DragControl.addDrop($$('webixText').$view, {
  $drop:function(source, target, event){
    var dnd = webix.DragControl.getContext();
    // target is the DOM element, so have to access webix widget with id

Updated snippet :

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download