You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by sunil m <sm...@neom.com> on 2006/08/10 21:35:04 UTC

DataTable - RowOnclick other options ?

Hi,

In my DataTable i want the user to click anywhere on the Row and execute the
JSF action. So for that I am using the attribute, 'rowOnClick' in the
Datatable and using the Javascript below to submit the Form,

document.forms['FormName'].elements['FormName:_link_hidden_'].value='FormName:dataTable:0:commandLink'

I am using version 1.4 snapshot. Prior to this i mean in version 1.1 the
commandLink Id was 'FormName:dataTable_0:commandLink' and now it has changed
to 'FormName:dataTable:0:commandLink'.  i.e. replaced '_' with a ':' .

Is there any other way to Submit a JSF form for an action to be executed by
the CommandLink ? Because I don't want to be dependent on JSF internal way
of handling 
commmandLinks.

Any input would be of great help !

Thanks,
Sunil M
-- 
View this message in context: http://www.nabble.com/DataTable---RowOnclick-other-options---tf2086631.html#a5750984
Sent from the My Faces - Dev forum at Nabble.com.


Re: DataTable - RowOnclick other options ?

Posted by sunil m <sm...@neom.com>.
Hi Mike,

Thanks for your quick response...

Yes I do have a Hidden 'CommandLink' in one of my columns as below,
<h:commandLink immediate="true" id="link" action="#{Bean.actionSelect}"
type="hidden" />

then I use the following javascript to  Force Submit the action of the
command link using,
document.forms['FormName'].elements['FormName:_link_hidden_'].value='FormName:dataTable:0:link'
document.forms[FormName].submit();

Because this way we are dependent on the way JSF creates ID for the
components and if ID creation logic changes with Upgrades then it will Break
the application.

So is this the Standard & proper way to do that or do we have any other way
to handle this situation ?
I wanted to ensure that I am following the norm. Hopefully you could advise
me on whats the best practice ?

Thanks,
Sunil



Mike Kienenberger wrote:
> 
> On 8/10/06, sunil m <sm...@neom.com> wrote:
>> In my DataTable i want the user to click anywhere on the Row and execute
>> the
>> JSF action. So for that I am using the attribute, 'rowOnClick' in the
>> Datatable and using the Javascript below to submit the Form,
>> document.forms['FormName'].elements['FormName:_link_hidden_'].value='FormName:dataTable:0:commandLink'
>>
>> I am using version 1.4 snapshot. Prior to this i mean in version 1.1 the
>> commandLink Id was 'FormName:dataTable_0:commandLink' and now it has
>> changed
>> to 'FormName:dataTable:0:commandLink'.  i.e. replaced '_' with a ':' .
>>
>> Is there any other way to Submit a JSF form for an action to be executed
>> by
>> the CommandLink ? Because I don't want to be dependent on JSF internal
>> way
>> of handling
>> commmandLinks.
> 
> Create a non-displayed, non-visible command-link component in one of
> your columns and force it to submit.
> 
> http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces
> http://wiki.apache.org/myfaces/SubmitPageOnValueChange
> 
> 

-- 
View this message in context: http://www.nabble.com/DataTable---RowOnclick-other-options---tf2086631.html#a5751664
Sent from the My Faces - Dev forum at Nabble.com.


Re: DataTable - RowOnclick other options ?

Posted by Mike Kienenberger <mk...@gmail.com>.
On 8/10/06, sunil m <sm...@neom.com> wrote:
> In my DataTable i want the user to click anywhere on the Row and execute the
> JSF action. So for that I am using the attribute, 'rowOnClick' in the
> Datatable and using the Javascript below to submit the Form,
> document.forms['FormName'].elements['FormName:_link_hidden_'].value='FormName:dataTable:0:commandLink'
>
> I am using version 1.4 snapshot. Prior to this i mean in version 1.1 the
> commandLink Id was 'FormName:dataTable_0:commandLink' and now it has changed
> to 'FormName:dataTable:0:commandLink'.  i.e. replaced '_' with a ':' .
>
> Is there any other way to Submit a JSF form for an action to be executed by
> the CommandLink ? Because I don't want to be dependent on JSF internal way
> of handling
> commmandLinks.

Create a non-displayed, non-visible command-link component in one of
your columns and force it to submit.

http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces
http://wiki.apache.org/myfaces/SubmitPageOnValueChange