I'm moving more of the initializer code over to get client id's etc. from data attributes - the "scanner" pattern for initialization that can be seen in some of tapestrys own components works really well (as opposed to setting up javascript modules with an initializer call as you have in your example) - there are of course places where the other approach makes more sense, but in general a lot of the modules we write at work return null or a closure exposing some named functions. Returning an initializer function seems less flexible when multiple modules needs to coordinate work.
On Tue, Nov 18, 2014 at 12:08 AM, Geoff Callender < geoff.callender.jumpst...@gmail.com> wrote: > Yes indeed. > > The reason I've developed the habit of using afterRender() is that so > often we need to pass the clientId of an embedded component to the > JavaScript. In afterRender() we can be sure that all clientIds have been > assigned. So now I just use afterRender() without giving it a second > thought. Eg. > > public void afterRender() { > > // Give "textbox hints" to the first name and last name fields. > > > javaScriptSupport.require("textbox-hint").with(firstNameField.getClientId(), > "Enter First Name", "#808080"); > > javaScriptSupport.require("textbox-hint").with(lastNameField.getClientId(), > "Enter Last Name", "#808080"); > } > Geoff > > On 18 Nov 2014, at 4:05 am, Thiago H de Paula Figueiredo < > thiag...@gmail.com> wrote: > > > On Mon, 17 Nov 2014 09:30:51 -0200, Chris Poulsen < > mailingl...@nesluop.dk> wrote: > > > >> I tend to think of the the "after render requires" as initializers, > > > > Actually, it can be used inside beginRender() or setupRender() with the > exact same result. :) Tapestry will only actually add the JavaScript stuff > after the whole HTML page is rendered anyway. > > > > -- > > Thiago H. de Paula Figueiredo > > Tapestry, Java and Hibernate consultant and developer > > http://machina.com.br > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > >