Hi
i have a tab control with 2 tabs. In each tab there is a tree.
Each tree retieve data from server (json data). I populate each tree in this way:
var treeSource =
{
localdata: dataEvent,
datatype: ‘json’
};
var dataAdapter2 = new $.jqx.dataAdapter(treeSource);
dataAdapter2.dataBind();
var recordss = dataAdapter2.getRecordsHierarchy(‘id’, ‘parentId’, ‘items’, [{ name: ‘text’, map: ‘label’ }, { name: ‘tag’, map: ‘value’}]);
$(‘#eventStructure’).jqxTree({ source: recordss, allowDrag: true, width: ‘100%’, height: ‘100%’, theme: ‘classic’ });
Then i would handle dragEnd event of each tree with this code:
$(“#eventStructure,#treeFunctions”).bind(‘dragEnd’, function (event) {
if (event.args.label) {
console.log(event.args.label);
var ev = event.args.originalEvent;
var x = ev.pageX;
var y = ev.pageY;
if (event.args.originalEvent && event.args.originalEvent.originalEvent && event.args.originalEvent.originalEvent.touches) {
var touch = event.args.originalEvent.originalEvent.changedTouches[0];
x = touch.pageX;
y = touch.pageY;
}
var offset = $(“#epl”).offset();
var width = $(“#epl”).width();
var height = $(“#epl”).height();
var right = parseInt(offset.left) + width;
var bottom = parseInt(offset.top) + height;
if (x >= parseInt(offset.left) && x <= right) {
if (y >= parseInt(offset.top) && y <= bottom) {
//$(“#epl”).val($(“#epl”).val() + ‘ ‘ +event.args.label);
alert(event.args.label);
}
}
}
});
The problem is that the event.args.label is wrong: Example : if i start drag from tree A i found in in events.args.label an information of another tree.
How it’s possible?
I’ve already seen the example of Tree Drag&Drop.
Tanks