AntonioV wrote:
> Hi Dan,
>
> Thanks for your reply. This is very informative (and should be in the TLD
> Docs, I assume).
>
The event topics and how to use them are documented in the TLD. Using
the window.onLoad event has been added to the release notes.
> This new approach makes it more difficult for us to reuse components
> (facelets ui:compositions) in our pages, because our components
> (compositions) do not contain "webuijsf:head" elements.
>
> I was thinking that we could publish an event on the "init()" method, and
> subsbscribe to that same event on each of our compositions, decoupling the
> compositions from the webuijsf:head/init() method.
>
Technically, script can appear anywhere in the page. Therefore, you
don't have to define your function in the head, if that's a problem? The
important thing is that you don't invoke your function until all the
elements in the page are available. Regardless of where your script is
defined, you can still use the window.onLoad event to initialize this
functionality.
Dan
> We'll experiment with that and will post here the results.
>
> Thanks,
> Antonio
>
>
>
> Dan Labrecque wrote:
>
>> AntonioV wrote:
>>
>>> Hi Dmitry,
>>>
>>> Thanks for your reply.
>>>
>>> I've tried out with the topic name you've suggested without success.
>>>
>>> What I've done is to add an event handler in the "onBlur" attribute, and
>>> that seems to be working correctly.
>>>
>>> Thanks again,
>>> Antonio
>>>
>>> P.S.: The topic names in the TLD docs for build #14 are not updated to
>>> dojo
>>> 0.9, I think (shall I file an issue for that?)
>>>
>>>
>> FYI, I checked the textField TLD below (build #14) and the event topics
>> are correct.
>>
>> http://webdev2.sun.com/woodstock-tlddocs
>>
>> Note that in order to subscribe to a topic, you must now use:
>>
>> <webuijsf:head>
>> <webuijsf:script>
>> var processEvents = {
>> update: function(props) {
>> // Do something...
>> }
>> }
>> function init() {
>> // Subscribe to event.
>>
>> dojo.subscribe(webui.suntheme.widget.textField.event.<eventname>.endTopic,
>> processEvents, "update");
>> }
>> </webuijsf:script>
>> </webuijsf:head>
>> <webuijsf:body onLoad="setTimeout('init();', 0)">
>> ...
>> |
>> |Not only did Dojo's function signature change for Dojo .9, but you must
>> subscribe after the widget has been created. In the example above, I'm
>> using the window.onLoad event to subscribe. You may not need the
>> timeout, but it ensure all HTML elements, widgets, etc. have been created.
>>
>> Dan
>>
>>
>>> Dmitry Kushner wrote:
>>>
>>>
>>>> Antonio
>>>>
>>>> Sorry - the event names have been changed with the migration to dojo
>>>> 0.9.
>>>> The following, for example is set of events our ajax implementation
>>>> subscribed to ( you can find this in
>>>> javascript.../widget/jsfx/textField.js)
>>>> ( @THEME@ gets translated to theme, so it becomes
>>>> webui.suntheme.widget.textField.event.validation.beginTopic)
>>>>
>>>> dojo.subscribe(webui._at_THEME@.widget.textField.event.refresh.beginTopic,
>>>> webui._at_THEME@.widget.jsfx.common, "processRefreshEvent");
>>>> dojo.subscribe(webui._at_THEME@.widget.textField.event.state.beginTopic,
>>>> webui._at_THEME@.widget.jsfx.common, "processStateEvent");
>>>> dojo.subscribe(webui._at_THEME@.widget.textField.event.submit.beginTopic,
>>>> webui._at_THEME@.widget.jsfx.common, "processSubmitEvent");
>>>> dojo.subscribe(webui._at_THEME@.widget.textField.event.validation.beginTopic,
>>>> webui._at_THEME@.widget.jsfx.textField, "processValidationEvent");
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_woodstock.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_woodstock.dev.java.net
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>