Hi,
I am trying fetch children nodes for destination node in drop event. Everything works ok, when read transport is configured as an object. But when I configure it as a function, it just reads root level nodes instead of children (there is no parameter id in data).
My code looks like this:
And transport read function:
Thanks in advance!
I am trying fetch children nodes for destination node in drop event. Everything works ok, when read transport is configured as an object. But when I configure it as a function, it just reads root level nodes instead of children (there is no parameter id in data).
My code looks like this:
01.
drop:
function
(e) {
02.
var
_tree =
this
,
03.
_src = _tree.dataItem(e.sourceNode),
04.
_dest = _tree.dataItem(e.destinationNode),
05.
_pos = e.dropPosition;
06.
07.
if
(_pos ==
"over"
) {
08.
if
(_dest.hasChildren) {
09.
if
(!_dest.loaded()) {
10.
var
_result = _dest.children.fetch();
11.
12.
}
13.
}
14.
}
15.
}
And transport read function:
01.
transport: {
02.
read:
function
(options) {
03.
$.ajax({
04.
url:
'@Url.Action("Read", "TreeView")'
,
05.
type:
'GET'
,
06.
dataType:
'json'
,
07.
data: options.data
08.
}).success(
function
(result) {
09.
return
options.success(result);
10.
}).error(
function
(result) {
11.
return
options.error(result);
12.
});
13.
}
14.
}
Thanks in advance!