You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Yury Luneff <bi...@ya.ru> on 2009/04/25 22:28:06 UTC

combobox cascade

Hello, users.

I need to write a component for tapestry 5.0.18.

The idea is simple: data is organized in a tree and tree is
represented by cascade of comboboxes.

When the page is first loaded, component draws a combobox (select)
with options that represent roots of that forest, then when the one
element is selected, another combobox appears with children elements
of the one that was selected. And so on. It's quite intuitive and I
like to write smth like that for my work.

But I need a hint of how this could be done best with tapestry.

Straightforward thought was to write a first combobox by java code
(without tapestry's select component) and do everything else through
AJAX: doing requests for children after each selection made and drawing new
comboboxes (and, of course, repainting everything if selection
changed). It should work, but I don't get how would I hook to form's
submit event so when selection is finished the corresponding page
would get id of the last selected entity. The thing i might do with js
programming is not integrated with tapestry, so submitting of the box
will not work and I still don't know how to do it not out of the box.

The one solution was to remember which node's children were asked the
last time on the server side, so onSubmit could just use that value,
but i want to decide in js code which one i'd like to be the value.
Perhaps, the user would want to keep his selection even if child
combobox renders. So this solution is not quite applicable.

Another way was to mess with tapestry's select and doing all needed
logic on server side with perhaps updating the whole component canvas
as a Block. But I don't know how to 1. create an array of components,
as each component should be injected with annotation. 2. dynamically
create the markup that tapestry would understand (e.g. "<t:select .."
so that components would have their anchor in the template).

Do anyone have any hint or suggestion of how this task would be done
in a proper tapestry way (or at least the one that would work ok)?

-- 
Best regards,
 Yury


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org