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?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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 ; |