Here is how I catch the 'row id' in my application:
<t:dataTable id="TheDataTable" var="data">
<h:column>
<f:facet name="header"><h:outputText value="Sequence #"/></f:facet>
<h:commandLink action="#{navigation.reload}">
<h:outputText value="#{data.sequenceNum}"/>
<t:updateActionListener property="#{bean.currentSequenceNum}"
value="#{data.sequenceNum}" />
</h:commandLink>
</h:column>
</t:dataTable>
This is generalized, stripped-down code - obviously I have other columns
and such. The user will see in the first column a list of numbers. If
they click a number, the <t:updateActionListener> will update the
property on the bean with the value they clicked (data.sequenceNum).
Then the <h:commandLink> tells navigation to reload the page. We use
somewhat odd navigation on our site, so don't get confused by that.
This works because
* I have a sequence number stored in each bean of the collection that
dataTable is displaying
* I can access that bean in the jsp by using the "var" attribute in
dataTable
If your data doesn't actually have a row id property, perhaps you should
add one.
Regards,
Jeff Bischoff
Kenneth L Kurz & Assoc, Inc.
Alex Burton wrote:
Thanks Volker.
How do you catch the 'row id' though?
Cheers,
Alex.
On 5/23/06, *Volker Weber* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Hi Alex,
we do this by using h:commandlink, with parameter, for displaying
the row data.
But you need to hit the text when clicking on a row.
regards,
Volker
2006/5/23, Alex Burton < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>:
> Hi all,
>
> I'm trying to use a datagrid as a way to quickly find and select a
> particular item from a large list of items. The items have several
> attributes I wish to display and can number in the 100's, so a
drop down
> list isn't the right way to go...
>
> So... I have my datagrid displaying beautifully... but am now
stumped on
> how to throw an even to catch a row selection... I know there are the
> rowOnClick="javascript" attributes in the datagrid, but how do i
bind that
> to something useful?
>
> Anyone have any pointers? Ideally I'd like to get the
"forceIdIndexFormula"
> value (or object it represents in my backing bean).
>
> Thanks in advance,
> Alex.
>
> --
> "We should move forwards, not backwards, upwards, not sideways,
and always
> twirling, twirling towards victory!"
--
"We should move forwards, not backwards, upwards, not sideways, and
always twirling, twirling towards victory!"