• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Displaying CommandLink in Datatable

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to conditionally display a h:commandLink in a dataTable row, based on a column in the DB for that row.

So for example, say the dataTable consists of three rows:

Col1, Col2, Col3
Hi, 0, NO
Hello, 1, NO
Hi, 0, YES

<h:commandLink styleClass="columnCommandLink" id="link25" action="#{dosomething}" rendered="#{var.col3IsYES}" >
<h:outputText value=" [Delete]"></h:outputText>
</h:commandLink>

I only want the delete link to show for the third element, so the output would look like this

Col1, Col2, Col3
Hi 0 NO [update]
Hello 1 NO [update]
Hi 0 YES [update] | [delete]

I have tried the above method - it doesnt work - it will just display or not display delete for ALL rows.

Any ideas?

Thanks
Ayan
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use the "rendered" attribute of h:commandLink to show/hide the link
 
Ayan Afridi
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said in the post - the "rendered" column for commandLink will display or not display the link for ALL the rows in the table. It will not conditionally display the link, row by row, as I showed above. Maybe I am using it incorrectly?

I showed How I am using it above.
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic