Setting the ID of an inputfield in dynamic columns Richfaces JSF-1.2 when not rendered - jsf

I've got dynamic columns. Some have Inputfields others don't.
Why do I have to set the Id of an Inputfield if I don't want to render it?
<rich:columns value="#{columnBean.columns}" var="column" index="ind" id="#{column.id}">
<f:facet name="header">
<h:inputText id="#{column.inputFilterId}" value="#{otherBean.filterValue[column.filterBy]}" onkeyup="filterKeyUp(event)" onclick="Event.stop(event);" />
</f:facet>
<h:outputText value="#{columnBean.lineItemHandler[line]}" rendered="#{columnBean.curCol[column.id]}"/>
</rich:columns>
I'm using JSF 1.2 and Richfaces 3.3.3 Final

I fixed it, just put a unique Id-Value from my Column Bean.
The better solution is to do this:
https://stackoverflow.com/a/18358949/5146922
THX BalusC

Related

MouseOver-Window in Primefaces Datatable

I have a Primefaces Datatable and each column filled with a OutputLabel. When the String in this label has to many characters, the text is not visible.
I'm looking for a way, to show a MouseOver-window or hint to show the full text. What would be the most painless way? Thanks in advance.
You can Use Primeface Tooltip component.
<p:tooltip value="<CONTENT_OF_TOOLTIP>" for="<COMPONENT_ID_ON_WHICH_TOOLTIP_WILL_APPEAR>" />
Even though the IDs generated in Primefaces Datable inner components are different over iteration of List, if you put p:tooltip also in table as in below example, primefaces will also generated dynamic IDs to p:tooltip component also.
Example:
<p:dataTable value="#{heroMBean.herosList}" var="h">
<p:column headerText="Name">
<h:outputText id="hname" value="#{h.name}"/>
<p:tooltip for="hname" value="#{h.name}"></p:tooltip>
</p:column>
<p:column headerText="Universe">
<h:outputText id="huniverse" value="#{h.universe}"/>
</p:column>
</p:dataTable>

Is it possible to add Row headers to a JSF or PrimeFaces datatable?

Well, I've been looking for any examples but all I could find was just examples in plain Java but I need to do something like this one or this other but in a JSF or PrimeFaces component.
Maybe this is what you are looking for:
<f:facet name="header">
Row Header Example
</f:facet>
Here is the complete example:
Primefaces showcase - DataTable - Group 1
I think you want something like a horizontal header, a don't think primefaces has it, but you can change the style of first cell like this:
<p:column headerText="Id">
<h:outputText value="#{car.id}" styleClass="someCssClass" />
</p:column>
The h:column tag has a property called rowHeader that does what you need.

JSF 2: duplicate IDs inside p:dataList

i have a list of billable services per client and i'm trying to build a table where the user can select which ones shall actually be billed:
<p:dataList value="#{billController.billings}" var="billings">
<p:dataTable value='#{billings.billablesDataModel}' var='item' selection="#{billings.toBill}">
<f:facet name="header">
<h:outputText value="#{billings.client.id}" />
</f:facet>
[...]
</p:dataTable>
</p:dataList>
the problem is, that all the dataTables are rendered with the same ID attribute (j_idt9:j_idt13:0:j_idt14) which is automatically assigned by JSF. i'm suspecting this is causing that the selection doesn't work. (the backing bean billings.toBill is not updated/stays empty.)
i was trying to set the ID attribute of the dataTable manually like this:
<p:dataTable id="#{billings.client.id}" ...>
however, i get the following error:
java.lang.IllegalArgumentException: Empty id attribute is not allowed
(#{billings.client.id} is definitely set to the unique client's ID as i get the right output from an h:outputText for debug purposes.)
can you help me fixing this?
i'm using JSF Mojarra 2.1.1 and PrimeFaces 3.2 on a Tomcat 6.
You need to use p:column for content of datalist as documented in user's guide.
What if you loop over billController.billings via ui:repeat and not via p:dataList:
<ui:repeat var="billings" value="#{billController.billings}">
<p:dataTable value="#{billings.billablesDataModel}" var="item" selection="#{billings.toBill}">
[...]
</p:dataTable>
</ui:repeat>

How dynamically generate ace:tabPane components?

I am using JSF 2.1 and ICEFaces 2 and I have a tabset like:
<ace:tabSet clientSide="true">
<ace:tabPane>
<f:facet name="label">My First Tab</f:facet>
<h:outputText value="One"></h:outputText>
</ace:tabPane>
<ace:tabPane>
<f:facet name="label">Second Tab</f:facet>
<h:outputText value="Two"></h:outputText>
</ace:tabPane>
<ace:tabPane>
<f:facet name="label">Third Tab</f:facet>
<h:outputText value="Third"></h:outputText>
</ace:tabPane>
</ace:tabSet>
Instead of hardcoding the tabPanes, I want to generate them dynamically based on a list. How can I achieve this by standard JSF or ICEFaces components?
I tried to use the <ui:repeat>, but it doesn't work:
<ui:repeat var="o" value="#{bean.myList}" varStatus="status">
<ace:tabPane>
<f:facet name="label">#{o.name}</f:facet>
<h:selectManyCheckbox value="#{o.valuesArray}" layout="pageDirection">
<f:selectItems value="#{o.checkboxes}" />
</h:selectManyCheckbox>
</ace:tabPane>
</ui:repeat>
I don't do ICEFaces, but you're encountering basically the same problem as RichFaces has with its <rich:tab>. As there exist no hypothetical <rich:tabs> (like as <rich:columns> which would be the dynamic variant of <rich:column>/<h:column>), one would have to use the view build time JSTL <c:forEach> tag to prepare the JSF view with those tags. You could apply the same on your ICEFaces page:
<ace:tabSet clientSide="true">
<c:forEach items="#{bean.tabs}" var="tab">
<ace:tabPane>
<f:facet name="label">#{tab.label}</f:facet>
<h:outputText value="#{tab.name}"></h:outputText>
</ace:tabPane>
</c:forEach>
</ace:tabSet>
Note that this will only fail if #{bean} is not a real managed bean, but an expression which in turn depends on an evaluation of another JSF component, such as <h:dataTable var="bean">.
The <ui:repeat> won't work as it's a render-time tag. It won't dynamically generate multiple JSF components before the JSF component tree is been built.
See also:
ICEFaces issue 6527 - Dynamically adding/removing ace:tabPane Results in ace:tabset Retrieving Entire Tabset Content
ICEFaces issue 6560 - New ace:tabs dynamic tabset component
i think you can write like this:
<ice:panelTabSet var="tab" value="#{mainTabsTempl.tabs}">
<ice:panelTab label="#{tab.label}">
body
</ice:panelTab>
</ice:panelTabSet>
It's not tabSet tag, but have the same work.

RichFaces rich:columns and sorting

does anyone know how to properly enable sorting on a rich:dataTable with columns generated on the fly using rich:columns tag?
Setting sortBy with an expression like #{row[column]} doesn't work for me.
I'm using RichFaces 3.3.1GA.
Here's the example:
<rich:dataTable id="table" value="#{localeHandler.locales}" var="row">
<rich:columns value="#{localeHandler.columns}" var="column" sortBy="#{row[column]}" >
<f:facet name="header">
<h:outputText value="#{column}"/>
</f:facet>
<h:outputText value="#{row[column]}"/>
</rich:columns>
</rich:dataTable>
whereas the localeHandler.locales is an ArrayList and localeHandler.columns is just an ArrayList containing the following values:
language, country, variant, displayName, displayLanguage, displayCountry, displayVariant
Try setting sortOrder to a bean property of type org.richfaces.model.Ordering for each column
I've found out that the last version where this feature worked was 3.3.0.CR1 - since 3.3.0.CR2 it's broken.
Please take a look at JIRA RF-6234 for workarounds.

Resources