Forgot. :)

TestPage.tml

<t:test.TestComponent t:id="abcd" t:count="countForComponentA" />

 <t:test.TestComponent t:id="hijk" t:count="countForComponentB" />

TestPage.java

public class TestPage {

  @Property
  @Persist
  private int countForComponentA;

  @Property
  @Persist
  private int countForComponentB;

}

TestComponent.tml

<t:container
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd";
xmlns:p="tapestry:parameter">

  <t:zone t:id="countZone" >
    Count : ${count}
  </t:zone>
  <t:eventLink t:async="true" t:event="updateCount" >Update Count for
Component ${compId}</t:eventLink>

</t:container>

TestComponent.java



public class TestComponent{


  @Parameter(required=true)
  @Property
  private int count;

  @Inject
  private ComponentResources componentResources;

  @Inject
  private AjaxResponseRenderer ajaxResponseRenderer;

  @InjectComponent
  private Zone countZone;

  public void onUpdateCount() {
    count++;
    ajaxResponseRenderer.addRender(countZone);
  }

  public String getCompId() {
    return componentResources.getId();
  }
}


On Thu, Feb 19, 2015 at 2:10 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 19 Feb 2015 11:01:13 -0200, Sumanth <roasteddra...@gmail.com>
> wrote:
>
>  Hello Users,
>>
>
> Hi!
>
> Please post the code when asking for help. We're not psychics (well, at
> least I know I'm not). :)
>
>
>
>> I am facing a problem with Tapestry components and would like to know if
>> this is a bug.
>>
>> I have two components which are the same . They have a count field and a
>> link to update the count via ajax.
>>
>> The problem is when you click on the link from the second component then
>> the count zone of the first component gets updated (from UI perspective).
>> But if you refresh the page, then the values are properly shown.
>>
>> Please see the screenshots for further explanations
>>
>> http://s7.postimg.org/qrz7zuqjf/Before_Clicking_Anything.png
>>
>> http://s4.postimg.org/nenbw7brh/After_Clicking_Second_Link.png
>>
>> http://s10.postimg.org/8kaij68rt/After_Refresh.png
>>
>>
>> Kind Regards,
>> Sumanth
>>
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to