Kiffi Well-Known Member Licensed User Longtime User Apr 29, 2014 #1 Hello, i have add dynatree to my index.html and now i want to get the active treenode. in JavaScript, the following snippet works for me: Code: $( "#myButton" ).on( "click", function() { var tree = $("#dynatree").dynatree('getTree'); var activeNode = tree.getActiveNode(); alert(activeNode); }); now i want to do the same in a B4J-WebApp (Websocket). I get the click-event and execute the following EvalWithResult(): Code: Dim Tree As Future = _ WS.EvalWithResult("$(arguments[0]).dynatree('getTree')", _ Array As Object(DynaTree.Id)) Log("Tree: " & Tree.Value) (DynaTree.Id contains the correct value #dynatree) ... but unfortunately Tree.Value is always null. My Question: is my EvalWithResult()-Call correct? I didn't find an example how to use it. Thanks in advance & Greetings ... Peter
Hello, i have add dynatree to my index.html and now i want to get the active treenode. in JavaScript, the following snippet works for me: Code: $( "#myButton" ).on( "click", function() { var tree = $("#dynatree").dynatree('getTree'); var activeNode = tree.getActiveNode(); alert(activeNode); }); now i want to do the same in a B4J-WebApp (Websocket). I get the click-event and execute the following EvalWithResult(): Code: Dim Tree As Future = _ WS.EvalWithResult("$(arguments[0]).dynatree('getTree')", _ Array As Object(DynaTree.Id)) Log("Tree: " & Tree.Value) (DynaTree.Id contains the correct value #dynatree) ... but unfortunately Tree.Value is always null. My Question: is my EvalWithResult()-Call correct? I didn't find an example how to use it. Thanks in advance & Greetings ... Peter
Erel B4X founder Staff member Licensed User Longtime User Apr 29, 2014 #2 Try: Code: WS.EvalWithResult("return $(arguments[0]).dynatree('getTree')" Upvote 0
Kiffi Well-Known Member Licensed User Longtime User Apr 29, 2014 #3 Hello Erel, whow! Faster than lightning! already tried. With 'return $(...' i get a uncaught TypeError (see attachment). Thanks & Greetings ... Peter Attachments 2014-04-29_152449.png 6 KB · Views: 680 Upvote 0
Hello Erel, whow! Faster than lightning! already tried. With 'return $(...' i get a uncaught TypeError (see attachment). Thanks & Greetings ... Peter
Erel B4X founder Staff member Licensed User Longtime User Apr 29, 2014 #4 Can you upload your project? You are trying to return an object that cannot be sent as is. You should instead return only the id or some other property. Upvote 0
Can you upload your project? You are trying to return an object that cannot be sent as is. You should instead return only the id or some other property.
Kiffi Well-Known Member Licensed User Longtime User Apr 29, 2014 #5 Erel said: You are trying to return an object that cannot be sent as is. You should instead return only the id or some other property. Click to expand... ah, ok, i see. Code: Dim ActiveNodeTitle As Future = _ WS.EvalWithResult("return $(arguments[0]).dynatree('getActiveNode').data.title", _ Array As Object(DynaTree.Id)) Log("ActiveNode: " & ActiveNodeTitle.Value) Now it works like a charm. Thanks a lot & Greetings ... Peter Upvote 0
Erel said: You are trying to return an object that cannot be sent as is. You should instead return only the id or some other property. Click to expand... ah, ok, i see. Code: Dim ActiveNodeTitle As Future = _ WS.EvalWithResult("return $(arguments[0]).dynatree('getActiveNode').data.title", _ Array As Object(DynaTree.Id)) Log("ActiveNode: " & ActiveNodeTitle.Value) Now it works like a charm. Thanks a lot & Greetings ... Peter