Hi, If a component is rendered then its #renderHead() should be called!
On Mon, Mar 9, 2015 at 4:08 AM, MadasamySankarapandian < madas...@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 ?! > { > 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. > } > } > } > > > -- > Thanks and regards > Madasamy >