Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1286

tacos:Tree ajax expand/collapse executes scripts of other (unupdated) components

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • 4.1.2
    • 4.1.5
    • None
    • None
    • tapestry 4.1.2-SNAPSHOT
      tacos 4.1.0-SNAPSHOT

    Description

      I have problems with initialization scripts when I use the tacos:Tree component in a Form.
      (Sorry if it is purely a tacos bug, but because as I know tacos uses tapestry's ajax services, I decided to report the issue here.)

      (See the responses below.)
      In case of response#2 the component's "visual part" is not updated (as expected) but its initialization script is still executed (which is unexpected).
      In case of some complex pages this causes major problems...

      I have attached a maven2 test application:

      • clicking on the second linksubmit results in response#1
      • expanding/collapsing tree nodes results in response#2

      Regards:
      Norbi

      Response#1

      <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
      <!ENTITY nbsp ' '>
      ]>
      <ajax-response><response id="componentWithInitializationScript" type="element"><div id="componentWithInitializationScript"
      >12</div></response><response id="initializationscript" type="script"><script>
      //<![CDATA[
      alert("initialization");
      //]]>
      </script></response></ajax-response>

      Response#2

      <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
      <!ENTITY nbsp ' '>
      ]>
      <ajax-response><response id="initializationscript" type="script"><script>
      //<![CDATA[
      tapestry.cleanConnect(dojo.byId("linkSubmit"),
      "onclick", "event918734307");
      tapestry.event918734307=function(e){
      dojo.event.browser.stopEvent(e);

      tapestry.form.submit("Form", "linkSubmit",

      {"async":true,"json":false,"url":"/treetest /app?component=%24Form&page=Home&service=direct&session=T"}

      );

      };
      dojo.event.connect(dojo.byId("linkSubmit"), "onclick", tapestry, "event918734307");
      tapestry.cleanConnect(dojo.byId("linkSubmit2"),
      "onclick", "event1420845853");
      tapestry.event1420845853=function(e){
      dojo.event.browser.stopEvent(e);

      tapestry.form.submit("Form", "linkSubmit2",

      {"async":true,"json":false,"url":"/treetest /app?component=%24Form&page=Home&service=direct&session=T&updateParts=componentWithInitializationScript" }); }

      ;
      dojo.event.connect(dojo.byId("linkSubmit2"), "onclick", tapestry, "event1420845853");
      alert("initialization");
      //]]>
      </script></response><response id="bodyscript" type="script"><script>
      //<![CDATA[
      dojo.require("dojo.event.common");
      dojo.require("tapestry.form");
      //]]>
      </script></response><response id="Formhidden" type="element"><div style="display:none;" id="Formhidden"
      ><input type="hidden" name="formids" value="foreachElement,If,If_0,If_1,If_2,If_3,If_4,linkSubmit,linkSubmit2"
      />
      <input type="hidden" name="component" value="$Form" />
      <input type="hidden" name="page" value="Home" />
      <input type="hidden" name="service" value="direct" />
      <input type="hidden" name="session" value="T" />
      <input type="hidden" name="submitmode" value="" />
      <input type="hidden" name="submitname" value="" />
      <input type="hidden" name="foreachElement" value="V100" />
      <input type="hidden" name="If" value="T" />
      <input type="hidden" name="foreachElement" value="V101" />
      <input type="hidden" name="If_0" value="F" />
      <input type="hidden" name="foreachElement" value="V102" />
      <input type="hidden" name="If_1" value="F" />
      <input type="hidden" name="foreachElement" value="V103" />
      <input type="hidden" name="If_2" value="F" />
      <input type="hidden" name="foreachElement" value="V200" />
      <input type="hidden" name="If_3" value="T" />
      <input type="hidden" name="foreachElement" value="V300" />
      <input type="hidden" name="If_4" value="T" />
      </div></response><response id="100" type="element"><div id="100">
      <div class="" style="margin-left: 0px;" id="nodeDiv">

      <a id="linkToggle" href="/treetest/app?component=tree.linkToggle&page=Home&service=direct
      &session=T&sp=100&sp=F&updateParts=100" onclick="return tapestry.linkOnClick(this.href
      ,'linkToggle', false)"><img src="/treetest/app?digest=1b03a3a11c8d48fa963aea8fa292fca0&service=asset
      &path=%2Fnet%2Fsf%2Ftacos%2Fcomponents%2Ftree%2Fclose.gif" border="0" align="absbottom" /></a>
      100
      </div><div id="101">
      <div class="" style="margin-left: 32px;" id="nodeDiv_0">
      101
      </div></div><div id="102">
      <div class="" style="margin-left: 32px;" id="nodeDiv_1">
      102
      </div></div><div id="103">
      <div class="" style="margin-left: 32px;" id="nodeDiv_2">
      103
      </div></div></div></response></ajax-response>

      Attachments

        1. TreeTest.zip
          10 kB
          Norbert Sándor

        Activity

          People

            andyhot Andreas Andreou
            snorbi Norbert Sándor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: