You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Strittmatter, Stephan" <St...@sybit.de> on 2007/03/29 09:06:05 UTC

submitOnEvent to submit on clicking dataTable-row

 
Hi,

I wonder how I could use sandbox tag submitOnEvent [1, 2] within
dataTable
to open details of clicked row.

Currently I use a hack with selfwritten JavaScript and hidden buttons in
every 
row like described in Sun's forum [3]. But I think, the submitOnEvent
would 
be much more elegant, but there are to open questions:

1. How can I define the tag for the row (not every cell)?
2. Is it possible to nest param-tags to the submitOnEvent-tag?

Or - probably there is another more common and elegant solution to do
this?

Thanks for any hints,

Stephan

[1] http://myfaces.apache.org/sandbox/tlddoc/s/submitOnEvent.html
[2] http://wiki.apache.org/myfaces/SubmitOnEvent
[3] http://forum.java.sun.com/thread.jspa?threadID=781630&tstart=0

RE: submitOnEvent to submit on clicking dataTable-row

Posted by "Strittmatter, Stephan" <St...@sybit.de>.
Hi Martin,

I want only invoke an actionListener and forward to a new detail-page.
I think it goes somehow in direction of yours solution, but I have 
no facelets. I will have a closer look on your solution and probably
the throw away my JS-hack which I do not like because it is dangerouse
to change somethin within the JSP and not breaking this feature.

Cheers, Stephan

-----Original Message-----
From: Martin Grotzke [mailto:martin.grotzke@javakaffee.de] 
Sent: Thursday, March 29, 2007 10:03 AM
To: MyFaces Discussion
Subject: Re: submitOnEvent to submit on clicking dataTable-row

Hi Stephan,

I'm not really sure what's your requirement: do you want to invoke some
javascript function when details are opened, or do you want to
invoke an actionListener in your backing bean?

For had the second requirement some time ago and wrote a custom
ComponentHandler for facelets, so this solution is only an option
if you're using facelets. With the ComponentHandler we were able
to add a new attribute "toggleDetailActionListener" to the dataTable
that accepts a method binding... A more detailed description you
find at
http://www.javakaffee.de/blog/2006/12/11/how-to-add-a-new-attribute-to-a
n-existing-jsf-component-using-facelets/
if it's of any interest for you.

Cheers,
Martin


On Thu, 2007-03-29 at 09:06 +0200, Strittmatter, Stephan wrote:
>  Hi,
> 
> I wonder how I could use sandbox tag submitOnEvent [1, 2] within
> dataTable
> to open details of clicked row.
> 
> Currently I use a hack with selfwritten JavaScript and hidden buttons
in
> every 
> row like described in Sun's forum [3]. But I think, the submitOnEvent
> would 
> be much more elegant, but there are to open questions:
> 
> 1. How can I define the tag for the row (not every cell)?
> 2. Is it possible to nest param-tags to the submitOnEvent-tag?
> 
> Or - probably there is another more common and elegant solution to do
> this?
> 
> Thanks for any hints,
> 
> Stephan
> 
> [1] http://myfaces.apache.org/sandbox/tlddoc/s/submitOnEvent.html
> [2] http://wiki.apache.org/myfaces/SubmitOnEvent
> [3] http://forum.java.sun.com/thread.jspa?threadID=781630&tstart=0
> 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Re: submitOnEvent to submit on clicking dataTable-row

Posted by Martin Grotzke <ma...@javakaffee.de>.
Hi Stephan,

I'm not really sure what's your requirement: do you want to invoke some
javascript function when details are opened, or do you want to
invoke an actionListener in your backing bean?

For had the second requirement some time ago and wrote a custom
ComponentHandler for facelets, so this solution is only an option
if you're using facelets. With the ComponentHandler we were able
to add a new attribute "toggleDetailActionListener" to the dataTable
that accepts a method binding... A more detailed description you
find at
http://www.javakaffee.de/blog/2006/12/11/how-to-add-a-new-attribute-to-an-existing-jsf-component-using-facelets/
if it's of any interest for you.

Cheers,
Martin


On Thu, 2007-03-29 at 09:06 +0200, Strittmatter, Stephan wrote:
>  Hi,
> 
> I wonder how I could use sandbox tag submitOnEvent [1, 2] within
> dataTable
> to open details of clicked row.
> 
> Currently I use a hack with selfwritten JavaScript and hidden buttons in
> every 
> row like described in Sun's forum [3]. But I think, the submitOnEvent
> would 
> be much more elegant, but there are to open questions:
> 
> 1. How can I define the tag for the row (not every cell)?
> 2. Is it possible to nest param-tags to the submitOnEvent-tag?
> 
> Or - probably there is another more common and elegant solution to do
> this?
> 
> Thanks for any hints,
> 
> Stephan
> 
> [1] http://myfaces.apache.org/sandbox/tlddoc/s/submitOnEvent.html
> [2] http://wiki.apache.org/myfaces/SubmitOnEvent
> [3] http://forum.java.sun.com/thread.jspa?threadID=781630&tstart=0
> 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/