• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

select a row

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need to select a row from the datatable and get the unique id from the table(unique id is in one of the column) and do actions . Please could anyone tell me a solution? I have been trying it since last 2 days. Please help me. I am using t:datatable and t:selectoneRadio to selectthe row.

Thank you very much,
Joe.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey joe,

this will definately help....
http://balusc.xs4all.nl/srv/dev-jep-dat.html

you can as a matter of fact get a handle to every unique row of a datatable , when you select a checkbox or radio in that particular row.
go through the link above .
 
Joe Jose
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sachin Sthalekar:
hey joe,

this will definately help....
http://balusc.xs4all.nl/srv/dev-jep-dat.html

you can as a matter of fact get a handle to every unique row of a datatable , when you select a checkbox or radio in that particular row.
go through the link above .



Thanks Sachin. Let me try and get back to you. One more doubt, can I use radio inside command link ? Will that work to get an id/value ?

Thanks,
Joe.
 
Joe Jose
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sachin,

I have tried what you said. But didn't work out. Command link action is not working.Here is my code :



bean :



Please help me.

Thanks,
Joe.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you really want to use selectOneRadio in a datatable to select the row, then do :

JSF:

JavaScript:

MyBean:
 
Joe Jose
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bauke,

Thanks for the reply.

I tried your code. But the onchange javascript is not working i think, it doesn't call the valueChangeListener as well.
my code is as follows :

jsp:


bean:



Can you please tell me where do I exactly give the valuechangelistener ?
It doesn't work for me.

Thanks,
Joe.
 
Joe Jose
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bauke,

I am getting the valuChangeListener when I put the bean in session scope. But I have some other problems when I put the bean in session. Can I do it request scope ? Or if put the bean in session , how can I clear it ?

Thanks for the help Bauke.

Joe.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It works in request scope in here. Try upgrading your JSF version.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im using JSF 2.x
and copy and pasted Baukes solutions. But still there is a Javascript error when I click "get selected row".
Any ideas?
 
Saloon Keeper
Posts: 27861
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're expecting a 2006 solution to still apply 6 years later?

Bauke hasn't been heard from for about 3 years now.
 
yusuf Kaplan
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:You're expecting a 2006 solution to still apply 6 years later?

Bauke hasn't been heard from for about 3 years now.



Maybe someone else then Bauke can answer my question...
 
Tim Holloway
Saloon Keeper
Posts: 27861
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, what I really meant was https://coderanch.com/how-to/java/DontWakeTheZombies

We don't charge extra if you start your own thread!
 
reply
    Bookmark Topic Watch Topic
  • New Topic