if you have a component that extends or implements IWidget tapestry will
resolve the client side code using dojo.widget.byId...(It'll also parse your
widget for you inline so your whole app isn't bogged down by needless
parsing of the entire dom tree).

Look at Autocompleter in the svn source for a good example.

http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/

On 9/11/06, Gerald Schöffel <[EMAIL PROTECTED]> wrote:

Hi Ben,

thank you for your reply ! I tried it right away ...

Would be too cool if this will work ... but for me it does not :(

When using targets="..:" tapestry is looking for a component like in
"[EMAIL PROTECTED]" ... but internally Tapestry is again connecting via
dojo.event.connect(dojo.byId(...),...)  by resolving the assigned ID of
the component.

Omitting the ID will not work, because Tapestry will render one with the
name of the component by default.

Being tricky naming all IDs the same will fail because of the 'wrong'
dojo.byId().

Hmmm ... Jesse ... how about something like
'element="widget:addressTable"' or 'widget="addressTable"' to get a
connection with dojo.widget.byId(...) ??

Or is there something included already ?

Worth an JIRA-entry ?

Thanks again for helping !!

Bye,
Gary

> Gary,
>
> If you change
> @EventListener(events="onSelect", elements="addressTable")
> to
> @EventListener(events="onSelect", targets="addressTable")
>
> then Tapestry will render the event script using dojo.widget.ByID
> (elements hooks to html elements, targets hooks to components/widgets)
>
> Hope that helps
> regards,
> Ben
>
> -----Original Message-----
> From: Gerald Schöffel [mailto:[EMAIL PROTECTED]
> Sent: Monday, 11 September 2006 2:10 PM
> To: Tapestry users
> Subject: Re: Is it possible to connect a dojo SortableTable to Tapestry
> 4.1.1 ?
>
> Ok, me again ... could not give up on this ...
>
> So I cleaned up my code and learned how to use the @Script-tag ...cool
thing
> :-)
>
> When connecting manually, the following code will work:
>
> dojo.event.connect(dojo.widget.byId("tableWidget"), "onSelect", window,
> "addressDisplay_selectAlert") ;
>
> This will display an alert whenever I click on a row.
>
> Tapestry will render the following when using @EventListener:
>
> dojo.event.connect(dojo.byId("addressTable"), "onSelect", tapestry,
> "event327750702");
>
> When using this syntax to connect the event by hand like
>
> dojo.event.connect(dojo.byId("addressTable"), "onSelect", window,
> "addressDisplay_selectAlert");
>
> it will NOT work.
>
> Hmmm ... is there a way to get this working with @EventListener ?
>
> The second possibility would be to do the 'eventhandling' (onSelect is a
> function-call, no event at all) with js and send another 'real' event to
> Tapestry. But as the first possibility ... I do not know, how to to so
:(
>
> Any help on this is really  desired :)
>
> Thank you !
>
> Bye,
> Gary
>
>
>> Hi Jesse !
>>
>> Thank you for your quick reply !
>>
>> But I already use
>>
>>             <binding name="parseWidgets" value="ognl:true" /> in my
>> shell component. So the widget is created and functional (clicking on
>> a header sorts the table and so on).
>>
>> The only 'issue' I have is binding the call to onSelect to an event
>> with @EventListener. There is just no request happening when clicking
>> and selecting table-rows (using firebug to do the 'debugging').
>>
>> Other events are working fine ... but this one is driving me nuts ...
>>
>> For today I will give up on this :(
>>
>> Tomorrow I will try to bind an event to a js-funtion with
>> dojo.event.connect manually to narrow this down.
>>
>> In the meantime: if anyone has an idea ... please let me know. :-)
>>
>> Bye
>> Gary
>>
>>
>>> The table won't be parsed into a dojo widget by default. (Tapestry
>>> turns this off..)
>>>
>>> You can probably add a single line of js to parse it out though:
>>>
>>> dojo.widget.createWidget(dojo.byId("addressTable"));
>>>
>>> On 9/10/06, Gerald Schöffel <[EMAIL PROTECTED]> wrote:
>>>
>>>> Hi there !
>>>>
>>>> I am trying to connect a dojo SortableTable via the @EventListener
>>>> annotation to Tapestry (4.1.1, latest build from svn).
>>>>
>>>> In my component html file I have something like this:
>>>>
>>>>    <table id="addressTable" dojoType="SortableTable"
>>>> widgetId="tableWidget" headClass="fixedHeader"
>>>> tbodyClass="scrollContent"
>>>>            enableMultipleSelect="false" enableAlternateRows="true"
>>>> rowAlternateClass="alternateRow" cellpadding="0" cellspacing="0"
>>>> border="0">
>>>>
>>>>    ...
>>>>
>>>>    </table>
>>>>
>>>> Inside my component I have the following annotation:
>>>>
>>>> @EventListener(events="onSelect", elements="addressTable")
>>>>
>>>> So now I am trying to get an event to Tapestry when a row is clicked
>>>> (firing 'onSelect' inside the SortableTable-Widget) - or even better
>>>> - when a row is double clicked, passing a parameter (getValue) to
>>>> the listener ....
>>>>
>>>> I think I have tested every combination of html-code/eventlistener
>>>> etc. (like doing <table jwcid="[EMAIL PROTECTED]" element="table"
>>>> id="...., changing elements="addressTable" to targets="addressTable"
>>>> etc.).
>>>>
>>>> I trying to do so the whole evening - without effort :(
>>>>
>>>> So is it possible to connect a plain dojo-widget to Tapestry this
>>>> way ? Or am I totally wrong ?
>>>>
>>>> Would by great to get some response  :)
>>>>
>>>> Thank you in advance !
>>>>
>>>> Bye,
>>>> Gary
>>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Reply via email to