How to fix alternating columnClasses in a JSF dataTable? - jsf

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"

Related

Why react-virtualized Multigrid renders the whole component but not one cell that was changed?

I have a Multigrid component with 12 columns and 300 rows. When the value of one cell changed the whole component is rendered. I can see it in the profiler and visually component is scrolled to the top. Is this intended behavior and this component or maybe whole library is not suit for lists that will updates frequentelly?
P.S. every cell has unique key based on remote data. In pure react table the problem I've described is not exist.

Is it possible to get localized value of boolean expression in PrimeFaces?

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?

How do I disable PrimeFaces column overflow hiding within a datatable

I'm currently working with a <p:dataTable> (from PrimeFaces 5.2) with many columns, and as I approach the width of the datatable's parent container, PrimeFaces starts hiding columns; unfortunately it seems to be the most important column (first on the left, a <p:datePicker>).
I've tried assigning that column a priority="1" and the other columns priority="3" as described on the ShowCase site, but the first column is still hidden.
In addition to just nesting the datatable within a <p:tabView> I've tried making the dataTable scrollable via scrollable="true" and assigning a width, or also try wrapping the datatable within a <p:scrollPanel> but the column was still being hidden in either case.
When I remove enough columns (from the right-most of the table), the hidden column will again reappear.
I'm interested in a solution that is not tied/hard-coded to a specific column, as I've run into this same issue on the 2nd column, or 3rd, depending on the resolution or browser width...I want to be sure that my users are seeing everything that was coded into the datatable, even if that means they have to scroll, rather than having a dynamic function suppress values unbeknownst to the user or myself.
Basically, I recommend to add tableStyle="width:auto" to a <p:datatable> so that you do not have to deal with the single columns width. Primefaces will handle it for you dynamically depending on the length of the column entry.

Moving the selected rows from one DataTable to Other inPrimeFaces 3.2

I'm new to PrimeFaces. In my project, I have a requirement to show 2 tables where user can select the rows and move to other datatable. In order to achieve this, can I use PickList component? If so, does it allow me show data with multiple columns. Any reference example is appreciated.
i dont think you need to use picklist. you can acheive this using primefaces drag and drop.
check it here
Drag and Drop components have special integration with data components. you can integrate drag and drop components with your datatable.
lemme know if this helps ...:)

Dynamically set cell/row style jsf 2.0

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.

Resources