[英]How to add a drop area to the text input?
我正在嘗試從數據表到Webix文本輸入實現DnD。 實際上,我為html輸入找到了一個示例 :
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;
}
})
但是我該如何將DropDrop添加到Webix ui.text中呢? 是否可以將DIV ID替換為某些內容? 關鍵是內部輸入的ID是動態的(存儲到您重新加載頁面之前才存儲),因此我看不到任何易於理解的方法來向其中添加放置區域。 任何想法表示贊賞。
這是基於先前示例的演示: http : //webix.com/snippet/14cbbeec
骯臟的解決方案是將addDrop添加到webix小部件的$ view屬性(= DOM元素):
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
$$('webixText').setValue(dnd.from.getItem(dnd.source[0]).title);
}
});
更新的代碼段: http : //webix.com/snippet/77363e5a
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.