Re: passing data from component class to javascript
On Thu, 15 May 2014 18:59:37 -0300, John wrote: I have a time picker component I need to pass an array of dates to. The picker will use the dates to choose whether displayed hours and minutes are selectable. I want all the disabling/enabling code to be client side. Do I pass data to the js functions in my regulra component in the same way as I would in mixins using a JSONObject and call addInitialiserCall in afterRender? Yep, you can do that. addInitializerCall(), addScript() and require() (5.4+) all work the same way regardless of being used in a page, component or mixin. Or is there a better/standard approach? Another approach, which is the one most used by Tapestry 5.4 internally, is to pass the data in data-* attributes. -- 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
Re: formatting attributes
If you really want this feature then you can write a custom binding prefix. It can work exactly as you want > I'm trying to steer our team away from embedding style and formatting in Java code Well, you need to either do it in the template or in the Java code. Both the template and the component class are for presentation logic so I don't see a problem putting it there. The added benefit is its easier to test. Horses for courses I guess... On 17 May 2014 00:00, "Aristedes Maniatis" wrote: > Lance Java wrote: > > I'm not sure how you have assumed that tapestry knows how understand a > "format:" binding prefix. Certainly none of the tapestry documentation > mentions it? > > I was trying to extrapolate from this: > http://wiki.apache.org/tapestry/Tapestry5HowToFormatDateTimeEtc > > Really, I wasn't hopeful it would work so much as provide an example for > what I'm trying to accomplish. > > > > The simple solution is to provide a getter for the formatted date String. > > > This is the exact thing I am trying to avoid. Our development team has > dozens of formatted strings scattered through Java and every time a design > change requires a small formatting alteration we have to rebuild the > application. > > I am not a tapestry expert, but I'm trying to steer our team away from > embedding style and formatting in Java code and instead make it easily > customisable in the tml files. In Rails, I'd do this no matter whether this > was in an element or attribute: > > <%= someDate.strftime("%m/%d/%Y") %> > > > In Spring/jstl I think there is . > > > Cheers > Ari > > > > > > On 14/05/2014 4:24pm, Aristedes Maniatis wrote: > > I understand that I can do this in the tml: > > > > format="literal:-MM-DD hh:mm:ss 'UTC' Z"> > > > > > > But I want to put the value into an attribute to suit a Google schema > microformat, like this: > > > > > > > > > > This does not work. What am I missing here? > > > > > > Ari Maniatis > > > > > > -- > --> > Aristedes Maniatis > ish > http://www.ish.com.au > Level 1, 30 Wilson Street Newtown 2042 Australia > phone +61 2 9550 5001 fax +61 2 9550 4001 > GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >