• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

how to retrieve a particular value from datatable

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

I have a datatable, in which I display 4 columns. I am able to retrieve the value of these 4 columns and store them where I want to.

Now, I need to store the value of a 5th column in a hidden input field. This 5th column should not be displayed in the datatable.
I tried but there is no option to hide a column in a datatable. How do I retrieve the 5th column from the bean, not display it in the datatable and store it in a hidden input field.


Please help on the same. Many thanks.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

If you don't declare 5th column in <h:outputtext>, it wont display right.

sorry..i didn't understand the question what you are trying to do.
 
Ranch Hand
Posts: 893
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you want a hidden 5th column?
 
Aparna Ram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, there are only 4 columns in the datatable that are displayed. This datatable is populated from a bean. The bean holds 5 values.

I want to store this fifth value in a hidden input field. How do I access this fifth column's value.
 
Aparna Ram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I need to display this bean value, that is not displayed in the datatable. If I was able to have a hidden column in the datatable, then I would just be able to access this value and things would go fine.

How do I go about doing the same?
 
Aparna Ram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, is there a way I can display the value of a "rendered = false" column in a h:datatable ?

Please guide.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since JSF is a server-side sort of framework, perhaps you can just store the data in a JSF-managed bean, in session scope. Then when the form submits, you can just get the value directly.

This may be unacceptable since your session size may get large. My only other recommendation is to play around with some DHTML and manually hide it. Or, just add it as a hidden input text field in one of the other columns.

Using rendered="false" attribute probably won't work because then the HTMl doesn't get rendered at all, which means the data won't be there. That is, if you do a View Source on the rendered HTML, it won't be there, so when the form submits, you won't see that data.
 
Remko Strating
Ranch Hand
Posts: 893
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I still don't know what for information your 5th column is holding, but you could in your backing bean just remove the last object which is seen by the table and put it as an another reference in your backing bean.
 
Aparna Ram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry.. I have not mentioned the question properly..
I would like to display the value of the 5th column(not displayed in datatable) which corresponds to the row that I have selected(clicked on).

The code in my first post shows the row selection.
 
Aparna Ram
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry.. this code shows row selection.

 
Ranch Hand
Posts: 376
Scala Monad
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the code I understand you want to use JavaScript
Mixing JSF and JavaScript is difficult (but not impossible).
You can use rendered="false" inside the cell, but then it will not be rendered at all, and you won't be able to get the value with JavaScript.
Have you tried setting the column width to 0% or 0px or 1px ?
Maybe that will do the trick...
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can use <f:param name="idAcct" value="#{data.idAcct}" />
 
Can't .... do .... plaid .... So I did this tiny ad instead:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic