Return-Path: X-Original-To: apmail-wicket-users-archive@minotaur.apache.org Delivered-To: apmail-wicket-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D541317C1C for ; Tue, 10 Mar 2015 08:01:55 +0000 (UTC) Received: (qmail 53934 invoked by uid 500); 10 Mar 2015 08:01:54 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 53884 invoked by uid 500); 10 Mar 2015 08:01:54 -0000 Mailing-List: contact users-help@wicket.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@wicket.apache.org Delivered-To: mailing list users@wicket.apache.org Received: (qmail 53873 invoked by uid 99); 10 Mar 2015 08:01:54 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Mar 2015 08:01:54 +0000 Received: from mail-ob0-f181.google.com (mail-ob0-f181.google.com [209.85.214.181]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 6A25E1A02E4 for ; Tue, 10 Mar 2015 08:01:54 +0000 (UTC) Received: by obbnt9 with SMTP id nt9so14401887obb.9 for ; Tue, 10 Mar 2015 01:01:53 -0700 (PDT) X-Received: by 10.60.112.65 with SMTP id io1mr15518270oeb.66.1425974513531; Tue, 10 Mar 2015 01:01:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.134.226 with HTTP; Tue, 10 Mar 2015 01:01:13 -0700 (PDT) In-Reply-To: References: From: Martin Grigorov Date: Tue, 10 Mar 2015 10:01:13 +0200 Message-ID: Subject: Re: Will renderHead method be invoked when a component is rendered via wicket events? To: "users@wicket.apache.org" Content-Type: multipart/alternative; boundary=001a1130d2fa5682ee0510ea907d --001a1130d2fa5682ee0510ea907d Content-Type: text/plain; charset=UTF-8 On Tue, Mar 10, 2015 at 3:11 AM, MadasamySankarapandian < madasamy@mcruncher.com> wrote: > On Mon, Mar 9, 2015 at 3:03 PM, Martin Grigorov > wrote: > > > Hi, > > > > If a component is rendered then its #renderHead() should be called! > > > > On Mon, Mar 9, 2015 at 4:08 AM, MadasamySankarapandian < > > madasamy@mcruncher.com> wrote: > > > > > I am using bootstrap-timepicker.js in a single page > application > > . > > > Time picker is added in a panel which is then embedded in the page. > When > > > the entire page is reloaded, the timepicker is working fine. However, > > when > > > the respective panel is displayed via Wicket events, the time picker is > > not > > > rendered. I am using Component#onEvent(Ievent) method to display the > > panel. > > > The javascript resource reference for timepicker is added in renderHead > > > method. I would like to know if a panel is reloaded during onEvent > call, > > > will rendeHead method be invoked or not? > > > > > > > > > Here are few code snippets to help you all understand what I am trying? > > > > > > public class BasePage > > > { > > > > > > public void renderHead(IHeaderResponse response) > > > > > > > >>Call super.renderHead(response) too. > > > > >>Is this a method in the page or in SelectionPanel ?! > > > > This method is in BasePage. > > > > > > { > > > response.render(JavaScriHeaderItem.forReference(new > > > JavaScriptResourceReference(bootstrap-timepicker.js))); > > > response.render(JavaScriHeaderItem.forReference(new > > > JavaScriptResourceReference(common.js))); > > > } > > > > > > //event is received to display panel > > > public void onEvent(IEvent ievent) > > > { > > > super.onEvent(ievent) > > > if(event.getPayLoad() instance of Notification) > > > { > > > Notification notification = (Notification) event.getPayload(); > > > PageParameters parameters = notification.getPageParameters() > > > Panel selectedPanel = getSelectedPanel(parameters, > > > notification.getPanelClass); > > > BasePage.this.selectedPanel.replaceWith(selectedPanel); > > > > > > > >>There is no Ajax here, so the whole page is re-rendered and > #renderHead() > > >>should be called for all visible components. > > > Sorry here ajax is involved. In the sample code i forgot to > add. > selectedPanel.setOutputMarkupId(true); > notification.getTarget().add(selectedPanel); > In that case only selectedPanel's #renderHead() will be called. BasePage#renderHead() won't be called because the page is not re-rendered with the Ajax response. Martin Grigorov Funemployed! Available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov > > > > > > } > > > } > > > } > > > > > > > > > -- > > > Thanks and regards > > > Madasamy > > > > > > > > > -- > Thanks and regards > Madasamy > --001a1130d2fa5682ee0510ea907d--