I use primefaces <p:datatable> component for displaying table data. Among the others, the table contains column with boolean values expressed by <p:selectBooleanCheckbox> component (chosen because of nice look).
However, when I try to export data using <p:dataExporter>, PF always renders logical values as 'true' or 'false' independently from the language. I would like to have values of those components rendered in language which I set in locale.
I have made localization of PrimeFaces calendar by adding global variable
PrimeFaces.locales['pl']= {...}
to javascript supporting PF and it works great for <p:calendar> component. Is it possible to do the same for boolean values?
Related
I have a string in props, depending on its value I want to give a property different value, or NO value at all, like I haven't specified it at all. How to?
I´ve implemented a datatable in JSF with a column with a attribute selectionMode="multiple".
Everything is working so far.
Is there a way to manipulate the value of the checkbox? I want to set the checkbox on the first load to checked or to unchecked, depending on a specific value.
The function i have implemented (in java) returns already true or false, but i need to set the checkboxValue to that value. What do i have to do to ?
You can manipulate the checkbox value through the value attribute like for any other component. See the DataTable demo with multiple selection:
DataTable - RadioCheckbox
I have a JSR-168 portlet application in which some portlets use a JSF dataTable.
All data tables have an attribute like:
columnClasses="wpsTableDataStart,,,,wpsTableDataEnd"
with the number of classes matching the number of columns in the table.
The app was originally installed on WebSphere Portal 6.0.
On that server version, HTML generated for data tables always has "wpsTableDataStart" as the class on the first column, "wpsTableDataEnd" as the class on the last column, and no class on other columns. This is what I'd expect from reading about dataTable attributes.
I've recently installed the same application on WebSphere Portal 7.0.
I had to upgrade project facets in Rational Application Developer and change some class references in the "faces-config.xml" file to make the app work, and it's now producing different HTML for dataTable column classes.
Instead of only having classes on the first and last column of the table, the two non-blank classes are being alternated.
I.e. the first column has the "wpsTableDataStart" class, the second column has the "wpsTableDataEnd" class, and other columns alternate those classes.
How do I make the columnClasses attribute behave as it did on Portal 6.0?
Solved by changing blank classes to spaces. E.g. the following produces the desired result on WebSphere Portal 7.0:
columnClasses="wpsTableDataStart, , , ,wpsTableDataEnd"
I am using an h:datatable which shows a summary of the data entered by a user in a session. The rows of the table are deletable at the users discretion. if the data meets certain criterion, the specific row in the table must be in red font color, else it should be black.
The methods I have tried so far are:
- Set the style value for h:outputtext component in each column value to red programmatically. But this changes entire columns color.
- Set the rowclasses programmatically, this again changes the style for all previous rows.
I am unable to target just one row or cell. I thought about using javascript, but without the id of the component I am not sure how to get the element.
Thanks.
Use the rowClasses attribute.
<h:dataTable value="#{bean.items}" var="item" rowClasses="#{bean.rowClasses}">
The getRowClasses() must return a comma separated string of CSS class names which are to be applied on rows (more specifically, the <tr> elements) repeatedly. You can create it based on the items inside bean's (post)constructor, action methods and/or even inside the getter.
For some reason, the StringBuffer was being overwritten thats the reason the change wasn't showing. I went with a simpler approach of adding an alert img to the rows that needed to be modified.
I am having a problem with nested EL for <t:inputText> required Attribute. I am using tomahawk implementation.
I have a dataTable with 2 columns of inputText. I have forceId=true for both the inputText
boxes. When you look at view source of page, id's looks as postal[0] and zone[0] where postalCode and zone are the id's of textBox and the number 0 is the rowId of dataTable.
My requirement here is zone inputText is required only when postal is not empty.
I have written something like below which I know is not right.
required="#{!empty param['postalCode[#{rowIndex}]']}">
Can some one suggest how to do it?
This should work:
required="#{!empty paramValues.postalCode[rowIndex]}"
The #{paramValues.name} returns a String[] with values in the indexed order.