Re: jqery not getting called after ajax refresh
I got a new problem with this. The browser loses focus. Please suggest what I can do to retain focus at selected element. here again my jquery $(document).ready(function(){ $(a.showHidePrograms).live('click', function(){ var $div= $(this).parent().next(div); if($div.attr(class) == 'hide'){ $div.attr(class,show); }else{ $div.attr(class,hide); } $(this).focus(); }); }); I tried adding .focus() method but did not work. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jqery-not-getting-called-after-ajax-refresh-tp1872270p2125879.html Sent from the Wicket - User 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: jqery not getting called after ajax refresh
if this is happening in an ajax request, you can use AjaxRequestTarget.focusComponent(foo); -- Jeremy Thomerson http://www.wickettraining.com On Tue, May 4, 2010 at 11:24 AM, fachhoch fachh...@gmail.com wrote: I got a new problem with this. The browser loses focus. Please suggest what I can do to retain focus at selected element. here again my jquery $(document).ready(function(){ $(a.showHidePrograms).live('click', function(){ var $div= $(this).parent().next(div); if($div.attr(class) == 'hide'){ $div.attr(class,show); }else{ $div.attr(class,hide); } $(this).focus(); }); }); I tried adding .focus() method but did not work. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jqery-not-getting-called-after-ajax-refresh-tp1872270p2125879.html Sent from the Wicket - User 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: jqery not getting called after ajax refresh
No this is not in ajaxrequest. It is just jquery. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jqery-not-getting-called-after-ajax-refresh-tp1872270p2126099.html Sent from the Wicket - User 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: jqery not getting called after ajax refresh
print out some unique attribute of the element that last regains focus to console.debug, maybe http://api.jquery.com/focusin/ will help. - roberto -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/jqery-not-getting-called-after-ajax-refresh-tp1872270p2126168.html Sent from the Wicket - User 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: jqery not getting called after ajax refresh
My link is a static html link its not ajax link ,and this link resides in AjaxFallbackDefaultDataTable , the repaint of this table containing is handled by AjaxFallbackDefaultDataTable. Please tell me how can I add the java script in this case ? -- View this message in context: http://n4.nabble.com/jqery-not-getting-called-after-ajax-refresh-tp1872270p1893590.html Sent from the Wicket - User 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: jqery not getting called after ajax refresh
have you tried using jQuery 1.4 live/delegate handlers? they will attach events to elements even after initial dom load. -- View this message in context: http://n4.nabble.com/jqery-not-getting-called-after-ajax-refresh-tp1872270p1896790.html Sent from the Wicket - User 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: jqery not getting called after ajax refresh
No , please tell more on usingjQuery 1.4 live/delegate, you have any example ? ok one more easy solution may be if I add the function in onclick attribute of the link , but I dont know to write jquery function in onclick attribute , please tell me how can I write the jquery function in onclick attribute ? http://n4.nabble.com/file/n1903859/2010-04-15_121948.png here is the function $(a.showHidePrograms).click( function () { var $div= $(this).parent().next(div); if($div.attr(class) == 'hide'){ $div.attr(class,show); }else{ $div.attr(class,hide); } } ); -- View this message in context: http://n4.nabble.com/jqery-not-getting-called-after-ajax-refresh-tp1872270p1903859.html Sent from the Wicket - User 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: jqery not getting called after ajax refresh
hopefully this helps: We can bind a simple click handler to this element: $('.clickme').bind('click', function() { // Bound handler called. }); When the element is clicked, the handler is called. However, suppose that after this, another element is added: $('body').append('lt;div class=clickmegt;Another targetlt;/divgt;'); This new element also matches the selector .clickme, but since it was added after the call to .bind(), clicks on it will do nothing. The .live() method provides an alternative to this behavior. If we bind a click handler to the target element using this method: $('.clickme').live('click', function() { // Live handler called. }); And then later add a new element: $('body').append('lt;div class=clickmegt;Another targetlt;/divgt;'); Then clicks on the new element will also trigger the handler. http://api.jquery.com/live/ jQuery Live -- View this message in context: http://n4.nabble.com/jqery-not-getting-called-after-ajax-refresh-tp1872270p1906384.html Sent from the Wicket - User mailing list archive at Nabble.com.
Re: jqery not getting called after ajax refresh
It works thanks . -- View this message in context: http://n4.nabble.com/jqery-not-getting-called-after-ajax-refresh-tp1872270p1908182.html Sent from the Wicket - User 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: jqery not getting called after ajax refresh
That's because your JS is only adding the onclick handler when the document is ready. Later, when you replace those links that you added the onclick handler to, they are replaced, and therefore no longer have the old onclick handlers. You will need to trigger the addition of your onclick handler again. (see target.appendJavascript(...)) -- Jeremy Thomerson http://www.wickettraining.com On Fri, Apr 9, 2010 at 1:12 PM, tubin gen fachh...@gmail.com wrote: I added this jquery code to my page. $(document).ready(function(){ $(a.showHidePrograms).click( function () { var $div= $(this).parent().next(div); if($div.attr(class) == 'hide'){ $div.attr(class,show); }else{ $div.attr(class,hide); } } ); }); inside my html I have a table this contains anchor tag with class showHidePrograms. onclick of this anchor tag the function gets called everything is fine. This page also has some ajaxLinks on click of this link I repaint the table, after thiswhen I click on anchor tag the jquery script is not called , does repainting somehow hides this anchor from jquery ?
RE: jqery not getting called after ajax refresh
It might be a good idea to use an IBehavior to contribute the script. You can add the behavior to the link component in wicket; when the behavior is rendered, it can contribute the javascript code to set it up with jquery. That way, you ensure that every new rendering of the link (which creates a new DOM element) includes your javascript (which binds your handler to the DOM element that is there right now), whether it's the first time on the page or from an ajax request. When you bind your event on page load, the ajax request creates a new DOM element for the link by repainting it, so the link that had your bound event handler goes away. RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: tubin gen [mailto:fachh...@gmail.com] Sent: Friday, April 09, 2010 2:12 PM To: users Subject: jqery not getting called after ajax refresh I added this jquery code to my page. $(document).ready(function(){ $(a.showHidePrograms).click( function () { var $div= $(this).parent().next(div); if($div.attr(class) == 'hide'){ $div.attr(class,show); }else{ $div.attr(class,hide); } } ); }); inside my html I have a table this contains anchor tag with class showHidePrograms. onclick of this anchor tag the function gets called everything is fine. This page also has some ajaxLinks on click of this link I repaint the table, after thiswhen I click on anchor tag the jquery script is not called , does repainting somehow hides this anchor from jquery ? This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind MSE to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: jqery not getting called after ajax refresh
Try function setup() { $(a.showHidePrograms).click( function () { var $div= $(this).parent().next(div); if($div.attr(class) == 'hide'){ $div.attr(class,show); }else{ $div.attr(class,hide); } } ); } $(document).ready(function(){ setup(); }); Then in your ajax method target.appendJavascript(setup();); On Fri, Apr 9, 2010 at 5:30 PM, Russell Morrisey russell.morri...@missionse.com wrote: It might be a good idea to use an IBehavior to contribute the script. You can add the behavior to the link component in wicket; when the behavior is rendered, it can contribute the javascript code to set it up with jquery. That way, you ensure that every new rendering of the link (which creates a new DOM element) includes your javascript (which binds your handler to the DOM element that is there right now), whether it's the first time on the page or from an ajax request. When you bind your event on page load, the ajax request creates a new DOM element for the link by repainting it, so the link that had your bound event handler goes away. RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: tubin gen [mailto:fachh...@gmail.com] Sent: Friday, April 09, 2010 2:12 PM To: users Subject: jqery not getting called after ajax refresh I added this jquery code to my page. $(document).ready(function(){ $(a.showHidePrograms).click( function () { var $div= $(this).parent().next(div); if($div.attr(class) == 'hide'){ $div.attr(class,show); }else{ $div.attr(class,hide); } } ); }); inside my html I have a table this contains anchor tag with class showHidePrograms. onclick of this anchor tag the function gets called everything is fine. This page also has some ajaxLinks on click of this link I repaint the table, after thiswhen I click on anchor tag the jquery script is not called , does repainting somehow hides this anchor from jquery ? This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind MSE to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: jqery not getting called after ajax refresh
Yes - this is the exact way to do it so that you don't have to duplicate the script on each request. Thanks for the great post! -- Jeremy Thomerson http://www.wickettraining.com On Fri, Apr 9, 2010 at 6:07 PM, Ben Tilford bentilf...@gmail.com wrote: Try function setup() { $(a.showHidePrograms).click( function () { var $div= $(this).parent().next(div); if($div.attr(class) == 'hide'){ $div.attr(class,show); }else{ $div.attr(class,hide); } } ); } $(document).ready(function(){ setup(); }); Then in your ajax method target.appendJavascript(setup();); On Fri, Apr 9, 2010 at 5:30 PM, Russell Morrisey russell.morri...@missionse.com wrote: It might be a good idea to use an IBehavior to contribute the script. You can add the behavior to the link component in wicket; when the behavior is rendered, it can contribute the javascript code to set it up with jquery. That way, you ensure that every new rendering of the link (which creates a new DOM element) includes your javascript (which binds your handler to the DOM element that is there right now), whether it's the first time on the page or from an ajax request. When you bind your event on page load, the ajax request creates a new DOM element for the link by repainting it, so the link that had your bound event handler goes away. RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com 304 West Route 38, Moorestown, NJ 08057 -Original Message- From: tubin gen [mailto:fachh...@gmail.com] Sent: Friday, April 09, 2010 2:12 PM To: users Subject: jqery not getting called after ajax refresh I added this jquery code to my page. $(document).ready(function(){ $(a.showHidePrograms).click( function () { var $div= $(this).parent().next(div); if($div.attr(class) == 'hide'){ $div.attr(class,show); }else{ $div.attr(class,hide); } } ); }); inside my html I have a table this contains anchor tag with class showHidePrograms. onclick of this anchor tag the function gets called everything is fine. This page also has some ajaxLinks on click of this link I repaint the table, after thiswhen I click on anchor tag the jquery script is not called , does repainting somehow hides this anchor from jquery ? This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind MSE to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org