Re: Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10)

2013-05-15 Thread Nico
Hi,

thanks for you quick replies! I will create the quick start and attach it to a 
jira ticket.

Thanks to your hint Martin, for the moment I will use jQuery#replaceWith() to 
make sure my app runs as expected.

Best
Nico


Am 14.05.2013 um 16:56 schrieb Martin Grigorov-4 [via Apache Wicket]:

 Hi, 
 
 We use 
 https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1617
 because 
 it is faster than jQuery#replaceWith(). 
 So yes, there is a small period when both the old and the new are in the 
 DOM. 
 As Sven asked - please create a quicktart and attach it to a ticket so we 
 can see whether we will find a solution or we will have to use the slower 
 way to replace. 
 
 
 On Tue, May 14, 2013 at 4:48 PM, Sven Meier [hidden email] wrote: 
 
  Create a quickstart and attach it to a Jira issue please. 
  
  Sven 
  
  
  On 05/14/2013 04:37 PM, Nico wrote: 
  
  Hi 
  
  I migrated my application from Wicket 1.5.10 to 6.7 
  
  During testing I recognized that during an ajax update (replacement) of a 
  component, the markup of the component is twice in the HTML markup (the 
  old 
  and the new markup). Thus the execution of javascript inside a component 
  may 
  fail due to the fact, that two components with the same id are present in 
  the HTML markup. 
  
  EXAMPLE 
  
  
  *HTML:* 
  lt;a wicket:id=quot;testlinkquot;**gt;testlinklt;/agt; 
  lt;div wicket:id=quot;testboxquot; style=quot;width: 100px; height: 
  100px; border: 1px solid #ccc;quot;gt; 
  lt;script type=quot;text/javascript**quot;gt; 
  alert(#39;hello#39;); 
  lt;/scriptgt; 
  lt;/divgt; 
  
  *JAVA:* 
  final WebMarkupContainer testbox = new WebMarkupContainer(testbox); 
  testbox.setOutputMarkupId(**true); 
  add(testbox); 
  
  add(new AjaxLinkVoid(testlink) { 
  private static final long serialVersionUID = 1L; 
  
  @Override 
  public void onClick(AjaxRequestTarget target) { 
  target.add(testbox); 
  } 
  }); 
  
  
  So while the ajax update is processed the 'testbox' DIV and its javascript 
  are present twice (the old and new DIV). If the javascript is a little 
  more 
  complex and for example changes stuff inside the DIV, the javascript will 
  change stuff in the old instead of the new DIV container. 
  
  My javascript relies on the fact, that an id should always be present just 
  once. 
  
  Why is the old DIV not removed first, before the new DIV is appended? Can 
  I 
  change this behavior somehow? 
  
  Thanks in advance 
  Nico 
  
  
  
  -- 
  View this message in context: http://apache-wicket.1842946.**
  n4.nabble.com/Component-twice-**in-markup-while-ajax-refresh-** 
  in-Wicket-6-7-migrated-from-1-**5-10-tp4658789.htmlhttp://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.html
   
  Sent from the Users forum mailing list archive at Nabble.com. 
  
  --**--**- 
  To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org[hidden 
  email] 
  For additional commands, e-mail: [hidden email] 
  
  
  
  --**--**- 
  To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org[hidden 
  email] 
  For additional commands, e-mail: [hidden email] 
  
 
 
 
 -- 
 Martin Grigorov 
 Wicket Training  Consulting 
 http://jWeekend.com http://jweekend.com/ 
 
 
 If you reply to this email, your message will be added to the discussion 
 below:
 http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4658791.html
 To unsubscribe from Component twice in markup while ajax refresh in Wicket 
 6.7 (migrated from 1.5.10), click here.
 NAML





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4658813.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10)

2013-05-14 Thread Nico
Hi

I migrated my application from Wicket 1.5.10 to 6.7

During testing I recognized that during an ajax update (replacement) of a
component, the markup of the component is twice in the HTML markup (the old
and the new markup). Thus the execution of javascript inside a component may
fail due to the fact, that two components with the same id are present in
the HTML markup.

EXAMPLE


*HTML:*
lt;a wicket:id=quot;testlinkquot;gt;testlinklt;/agt;
lt;div wicket:id=quot;testboxquot; style=quot;width: 100px; height:
100px; border: 1px solid #ccc;quot;gt;
lt;script type=quot;text/javascriptquot;gt;
alert(#39;hello#39;);
lt;/scriptgt;
lt;/divgt;

*JAVA:*
final WebMarkupContainer testbox = new WebMarkupContainer(testbox);
testbox.setOutputMarkupId(true);
add(testbox);

add(new AjaxLinkVoid(testlink) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
target.add(testbox);
}
});


So while the ajax update is processed the 'testbox' DIV and its javascript
are present twice (the old and new DIV). If the javascript is a little more
complex and for example changes stuff inside the DIV, the javascript will
change stuff in the old instead of the new DIV container.

My javascript relies on the fact, that an id should always be present just
once.

Why is the old DIV not removed first, before the new DIV is appended? Can I
change this behavior somehow?

Thanks in advance
Nico



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10)

2013-05-14 Thread Sven Meier

Create a quickstart and attach it to a Jira issue please.

Sven

On 05/14/2013 04:37 PM, Nico wrote:

Hi

I migrated my application from Wicket 1.5.10 to 6.7

During testing I recognized that during an ajax update (replacement) of a
component, the markup of the component is twice in the HTML markup (the old
and the new markup). Thus the execution of javascript inside a component may
fail due to the fact, that two components with the same id are present in
the HTML markup.

EXAMPLE


*HTML:*
lt;a wicket:id=quot;testlinkquot;gt;testlinklt;/agt;
lt;div wicket:id=quot;testboxquot; style=quot;width: 100px; height:
100px; border: 1px solid #ccc;quot;gt;
lt;script type=quot;text/javascriptquot;gt;
alert(#39;hello#39;);
lt;/scriptgt;
lt;/divgt;

*JAVA:*
final WebMarkupContainer testbox = new WebMarkupContainer(testbox);
testbox.setOutputMarkupId(true);
add(testbox);

add(new AjaxLinkVoid(testlink) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
target.add(testbox);
}
});


So while the ajax update is processed the 'testbox' DIV and its javascript
are present twice (the old and new DIV). If the javascript is a little more
complex and for example changes stuff inside the DIV, the javascript will
change stuff in the old instead of the new DIV container.

My javascript relies on the fact, that an id should always be present just
once.

Why is the old DIV not removed first, before the new DIV is appended? Can I
change this behavior somehow?

Thanks in advance
Nico



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10)

2013-05-14 Thread Martin Grigorov
Hi,

We use
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1617
because
it is faster than jQuery#replaceWith().
So yes, there is a small period when both the old and the new are in the
DOM.
As Sven asked - please create a quicktart and attach it to a ticket so we
can see whether we will find a solution or we will have to use the slower
way to replace.


On Tue, May 14, 2013 at 4:48 PM, Sven Meier s...@meiers.net wrote:

 Create a quickstart and attach it to a Jira issue please.

 Sven


 On 05/14/2013 04:37 PM, Nico wrote:

 Hi

 I migrated my application from Wicket 1.5.10 to 6.7

 During testing I recognized that during an ajax update (replacement) of a
 component, the markup of the component is twice in the HTML markup (the
 old
 and the new markup). Thus the execution of javascript inside a component
 may
 fail due to the fact, that two components with the same id are present in
 the HTML markup.

 EXAMPLE


 *HTML:*
 lt;a wicket:id=quot;testlinkquot;**gt;testlinklt;/agt;
 lt;div wicket:id=quot;testboxquot; style=quot;width: 100px; height:
 100px; border: 1px solid #ccc;quot;gt;
 lt;script type=quot;text/javascript**quot;gt;
 alert(#39;hello#39;);
 lt;/scriptgt;
 lt;/divgt;

 *JAVA:*
 final WebMarkupContainer testbox = new WebMarkupContainer(testbox);
 testbox.setOutputMarkupId(**true);
 add(testbox);

 add(new AjaxLinkVoid(testlink) {
 private static final long serialVersionUID = 1L;

 @Override
 public void onClick(AjaxRequestTarget target) {
 target.add(testbox);
 }
 });


 So while the ajax update is processed the 'testbox' DIV and its javascript
 are present twice (the old and new DIV). If the javascript is a little
 more
 complex and for example changes stuff inside the DIV, the javascript will
 change stuff in the old instead of the new DIV container.

 My javascript relies on the fact, that an id should always be present just
 once.

 Why is the old DIV not removed first, before the new DIV is appended? Can
 I
 change this behavior somehow?

 Thanks in advance
 Nico



 --
 View this message in context: http://apache-wicket.1842946.**
 n4.nabble.com/Component-twice-**in-markup-while-ajax-refresh-**
 in-Wicket-6-7-migrated-from-1-**5-10-tp4658789.htmlhttp://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.html
 Sent from the Users forum mailing list archive at Nabble.com.

 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
Wicket Training  Consulting
http://jWeekend.com http://jweekend.com/