Hello!
For some tasks it is necessary to know the level of the particular node. Is it possible now? Or, could you add this attribute to the tree node?
procedure TIWForm3.IWAppFormCreate(Sender: TObject);
begin
IWCGJQDynaTree1.JQDynaTreeOptions.OnLazyRead.Script:= 'function(dtnode){ dtnode.data.nodeLevel = dtnode.getLevel(); }';
end;
procedure TIWForm3.IWCGJQDynaTree1GetChildrenNodes(Sender: TObject; ANodeData: ISuperObject; var AJSon: ISuperObject);
var
JSonObj: ISuperObject;
I: Integer;
nLvl: Integer;
begin
nLvl:= ANodeData.I['nodeLevel'];
AJSon:= TSuperObject.Create(stArray);
for I := 1 to 5 do
begin
JSonObj:= SO();
JSonObj.S['key']:= 'childId_' + IntToStr(i);
JSonObj.S['title']:= 'Child ' + IntToStr(i);
JSonObj.B['isLazy']:= True; // load children via ajax
AJSon.AsArray.Add(JSonObj);
end;
end;