Hi,<div><br></div><div>I am using Seaside 3.0 which is included in the VW7.7 image and am trying to create a JQPlugin for jstree (<a href="http://www.jstree.com/demo">http://www.jstree.com/demo</a>). </div><div><br></div><div>
I got the basic functionality working on the tree, but now I would like to have the user create new nodes in the tree using hte context menu.</div><div><br></div><div>JSTree offers this functionality by binding a function to a create node event.</div>
<div><br></div><div>(php example)</div><div><br></div><div><div>.bind(&quot;create.jstree&quot;, function (e, data) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$.post(</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>&quot;./server.php&quot;, </div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>{ </div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>&quot;operation&quot; : &quot;create_node&quot;, </div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>&quot;id&quot; : data.rslt.parent.attr(&quot;id&quot;).replace(&quot;node_&quot;,&quot;&quot;), </div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>&quot;position&quot; : data.rslt.position,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>&quot;title&quot; : <a href="http://data.rslt.name">data.rslt.name</a>,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>&quot;type&quot; : data.rslt.obj.attr(&quot;rel&quot;)</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>}, </div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>function (r) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>if(r.status) {</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>$(data.rslt.obj).attr(&quot;id&quot;, &quot;node_&quot; + <a href="http://r.id">r.id</a>);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>else {</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>$.jstree.rollback(data.rlbk);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>})</div></div><div><br></div><div>In this javascript example, the parameters are sent to the server using a JQuery Post. The second function takes care of the result and does a rollback if  the creation failed.</div>
<div><br></div><div>I want to have the the same functionality in seaside like this:</div><div><br></div><div>((html jQuery id: treeId) tree)</div><div>plugins: #(&#39;json_data&#39; &#39;themes&#39; &#39;ui&#39; &#39;contextmenu&#39; &#39;dnd&#39;);</div>
<div>getChildrenBlock: [:node | self getChildren: node];</div><div>theme: &#39;default&#39;;</div><div>types: self treeTypes;</div><div>animation: 0;</div><div>createBlock: [:node :position :title :type | ] onSuccess: [:node :s | ] onFail: [:ex :s | ] </div>
<div><br></div><div>The createBlock first argument holds the seaside translated objects from the javascript call, the second should be executed when the first block executes correctly and the third should be executed when the command failed. The onSuccessBlock should also hold the newly created node and a script to do something wiht the newly created node.</div>
<div><br></div><div>What is the best way to accomplish this using a post call instead of a get call? I probably could get this running with a normal GET jquery callback, but I am worried about the length of the get request when using proxies who cut off long urls (this happens quite a lot unfortunatly)</div>
<div><br></div><div>I hope anyone could push me in the right direction. </div><div><br></div><div>Regards,</div><div><br></div><div><br></div><div>Bart Veenstra</div><div><br></div>