Hi, Such kind of code should really be executed within #renderHead() with OnDomReadyHeaderItem. Don't let any JS try to use your HTML DOM elements before the DOM is available.
On Mon, Feb 25, 2013 at 3:05 PM, Martin Dietze <[email protected]> wrote: > OK, I've changed the subject, as it seems like I'm running into > a more general issue here. The original issue was JS code > rendered into a flyout with search results in my application > never made it into the markup the browser actually sees. > > Now I've identified another problem which seems identical in its > cause. I have an editor component using CKEditor. The component > derives from Panel. In its onRender() method it has the > following code: > > | @Override > | public void onRender() { > | super.onRender(); > | final Response response = getResponse(); > | final String markupId = textField.getMarkupId(); > | JavaScriptUtils.writeJavaScript( response, > | "if (CKEDITOR.instances['" + markupId + "']) > CKEDITOR.remove(CKEDITOR.instances['" + markupId + "']);" // > | "var editor_" + markupId + " = CKEDITOR.replace('" + markupId > + "');" // > | ); > | } > > This renders a little JS code block under the Wicket TextField > instance that holds the text for CKEditor. > > The code works well if the editor component has been in the > page from the beginning. However if I make the component visible > via Ajax (e.g. after clicking an AjaxLink), the JS code is not > rendered at all. > > I am still in the process of migrating my project from Wicket > 1.4.x to 6.6.0. The above code worked flawlessly with 1.4.x. > > Am I making a mistake, or is this a problem in Wicket? > > Cheers, > > M'bert > > -- > ----------- / http://herbert.the-little-red-haired-girl.org / > ------------- > =+= > Nachts wache ich schweißgebadet auf, weil OE-begeisterte Newbies mit Bill > Gates hinterm Newsserver Schwarze Messen feiern, und auch mein Psychologe > ist schon total ratlos. Ich habe einfach fertig. -- anonymer Troll in dsnu > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>
