For code similar to that below, the title does not appear when the cursor hovers over a column header. Any ideas?
<h:column title="COLUMN 1">
<f:facet name="header" >COL 1</f:facet>
<h:outputText id="col1" value="#{oneEntry.col1}" styleClass="al"/>
</h:column>
<h:column title="COLUMN 2">
<f:facet name="header" >COL 2</f:facet>
<h:outputText id="col2" value="#{oneEntry.col2}" styleClass="al"/>
</h:column>
The <h:column> tag has no HTML 4.0 pass-through attributes as JSF generates these as nothing but <td> elements. And in HTML, tables consist of <td> elements within rows and columns are implicitly defined within the rows.
So it is liking specifying the title attribute for each particular <td> element of each and every row.
<table border="1">
<tr>
<td title="first">Cell A1</td>
<td>Cell B1</td>
</tr>
<tr>
<td title="first">Cell A2</td>
<td>Cell B2</td>
</tr>
</table>
So there is nothing like specifying an overall title for the column in HTML, you can have a title for <table> tag which is nothing but <h:dataTable>.
Or you can have title on individual data cells by adding title to your components inside that column like this:
<h:column>
<f:facet name="header" >COL 1</f:facet>
<h:outputText id="col1" value="#{oneEntry.col1}" styleClass="al" title="COLUMN 1"/>
</h:column>
<h:column>
<f:facet name="header" >COL 2</f:facet>
<h:outputText id="col2" value="#{oneEntry.col2}" styleClass="al" title="COLUMN 2"/>
</h:column>
which generates a <span> containing the value of the outputText with the title attribute.
If you use Primefaces, you can use similar code
<p:column>
<f:facet name="header">
<h:outputText value="TYPE" title="LINK-TYPE (DIRECT,TDR,TLGA)"/>
</f:facet>
<h:outputText escape="false" value="#{test.getLinkType()}"/>
</p:column>
I think that the solution to your problem is to define <f:facet> as you done in your example AND to put <h:outputText> in <f:facet> !
Using your example, you will obtain following code
<h:column>
<f:facet name="header">
<h:outputText value="COL 1" title="COLUMN 1"/>
</f:facet>
<h:outputText id="col1" value="#{oneEntry.col1}" styleClass="al"/>
</h:column>
<h:column title="COLUMN 2">
<f:facet name="header">
<h:outputText value="COL 2" title="COLUMN 2"/>
</f:facet>
<h:outputText id="col2" value="#{oneEntry.col2}" styleClass="al"/>
</h:column>
Related
Version :
RichFaces 4.3.5
Apache MyFaces 2.1
Issue :
We are migrating from JSF 1.2 to JSF2.
As shown in below code , rich:dataTable uses columnClasses attribute to style columns.
The issue is columnClasses are not getting applied repetitively .
That is , if there are four columns , we need to specify four columnClasses attribute values separately like columnClasses=column1,column1,column1,column1.
This is really annoying since I need to use same columnClass for all columns.
I tried using spaces for columnClasses like columnClasses=column1 column1 , but no success.
Has anybody faces same issue ? Is there any workaround for this apart from specifying columnClasses manually ?
Code :
<rich:dataTable id="userList" styleClass="style1" headerClass="header1" rowClasses="table_evenRow,table_oddRow"
columnClasses="column1,column1,column1,column1" value="#{bean.userList}" var="user">
<f:facet name="header">
<rich:columnGroup columnClasses="table_header">
<h:column>
<h:outputText value="First Name" />
</h:column>
<h:column>
<h:outputText value="Last Name" />
</h:column>
<h:column>
<h:outputText value="Email" />
</h:column>
<h:column>
<h:outputText value="Phone" />
</h:column>
</rich:columnGroup>
</f:facet>
<h:column>
<h:outputText value="#{user.firstName}" />
</h:column>
<h:column>
<h:outputText value="#{user.lastName}" />
</h:column>
<h:column>
<h:outputText value="#{user.email}" />
</h:column>
<h:column>
<h:outputText value="#{user.phoneNum}" />
</h:column>
</rich:dataTable>
I had the same issue and as Vasil Lukach mentioned in a comment, columnClasses="right,left,"... only adds a css class to the td elements in the dom-tree.
e.g.:
<td id="form:table:0:j_idt36" class="rf-dt-c right">2</td>
In order to have an effect some css is required:
.left {
text-align: left;
}
.right {
text-align: right;
}
I have a list of products which is displayed in datatable ,and want to edit a particular row from the datatable in a pop up as described below
A datatable with all the employee details, each row has edit button.On clicking the edit button the new pop-up should be displayed with the existing information of particular clicked product and after editing, the changes must be reflected for that particular object in the list as well in datatable.
I am struggling for it but i could not save the changes in edited product. when the pop up is opened, l can see the selected item properties but when I changed the properties, nothing changes.
here is the my jsf code.
<a4j:outputPanel ajaxRendered="true">
<h:dataTable id="table1" value="#{productBean.products}" var="item"
styleClass="resultTable" headerClass="resultTableHeader"
rowClasses="resultTableRow">
<h:column>
<f:facet name="header">
<h:outputText value="Part#" />
</f:facet>
<h:outputText value="#{item.partNumber}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Product Description" />
</f:facet>
<h:outputText value="#{item.description}" />
</h:column>
<h:column>
<a4j:commandButton value="Edit" action="#{productBean.setEditItem(item)}" oncomplete="#{rich:component('popup')}.show()"> </a4j:commandButton>
<rich:popupPanel id="popup" modal="true" resizeable="true"
onmaskclick="#{rich:component('popup')}.hide()">
<f:facet name="header">
<h:outputText value="Edit property of the product" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#"
onclick="#{rich:component('popup')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<!-- editProduct ı burda item yerine kullan -->
<table style="align: center;">
<tr>
<td><h:panelGrid columns="2">
<h:outputText value="Description"></h:outputText>
<h:inputText value="#{productBean.item.description}"></h:inputText>
</h:panelGrid></td>
</tr>
<tr>
<td><h:panelGrid columns="2">
<h:outputText value="Part Number"></h:outputText>
<h:inputText value="#{item.partNumber}"></h:inputText>
</h:panelGrid></td>
</tr>
</table>
<a4j:commandButton value="Submit" action="#{productBean.actionEditProductsFromDatabase(item)}" execute="#popup"/>
<a4j:commandButton value="Cancel" onclick="#{rich:component('editPane')}.hide(); return false;" />
</rich:popupPanel>
</h:column>
</h:dataTable>
</a4j:outputPanel>
</h:form>
Refer to the Placement callout in the RichFaces Component Reference:
http://docs.jboss.org/richfaces/latest_4_X/Component_Reference/en-US/html_single/#sect-Component_Reference-Panels-richpopupPanel
The <rich:popupPanel> component is usually rendered in front of any
other objects on the page. This is achieved by attaching the component
to the <body> element of the page, and setting a very high "z-index"
(the stack order of the object). This approach is taken because
relatively-positioned elements could still overlap the pop-up panel if
they exist at higher levels of the DOM hierarchy, even if their
z-index is less than the <rich:popupPanel> component.
If the <rich:popupPanel> is to participate in submitting child
components/behaviors, then a form element must be nested within the
<rich:popupPanel>. Alternatively, if no overlapping elements exist,
the <rich:popupPanel> component can be reattached to its original DOM
element by setting domElementAttachment to either parent or form.
I can not find a primefaces datatable example on how to make one item to be shown on two (or more) rows.
I need to show an item in a datatable about like this:
<table>
<tr>
<td>Text 1 from entry</td>
<td>Text 2 from entry</td>
</tr>
<tr>
<td colspan="2">Text 3 from entry</td>
</tr>
</table>
Can it be done or should I use some other tag to render like this?
I tried:
...xmlns:p="http://primefaces.org/ui"...
<p:dataTable var="item" value="#{bean.items}">
<p:column>
<p:row>
<p:column>
<h:outputText value="#{item.title}" />
</p:column>
<p:column>
<h:outputText value="#{item.shortText}" />
</p:column>
</p:row>
<p:row>
<p:column colspan="2">
<h:outputText value="#{item.longText}" />
</p:column>
</p:row>
</p:column>
</p:dataTable>
But obviously this is wrong and/or I have misunderstood the concept of using 'p:row'. I can not find any explanation on how to do this properly, so any advice would be appreciated.
Why don't you want to use the <p:panelGrid> component that can achieve this functionality easily?
Basic example:
<p:panelGrid>
<p:row>
<p:column>Text 1 from entry</p:column>
<p:column>Text 2 from entry</p:column>
</p:row>
<p:row>
<p:column colspan="2">Text 3 from entry</p:column>
</p:row>
</p:panelGrid>
That embedded, we have:
<p:dataTable var="item" value="#{bean.items}">
<p:column>
<p:panelGrid>
<p:row>
<p:column><h:outputText value="#{item.title}" /></p:column>
<p:column><h:outputText value="#{item.shortText}" /></p:column>
</p:row>
<p:row>
<p:column colspan="2"><h:outputText value="#{item.longText}" /></p:column>
</p:row>
</p:panelGrid>
</p:column>
</p:dataTable>
I have a problem with a dataTable component using Tomahawk.
I want to make a datatable with subcolumns in some columns. Something like that:
This table only have 2 rows but its duplicated. Here is the code:
<t:dataTable id="tabla1" value="#{userControl.mc64cljobs_encolados}" var="clh">
<t:column id="col1" >
<f:facet name="header" >
<h:outputText styleClass="leftColumn" value="Options"/>
</f:facet>
<t:dataTable id="tabla2" value="#{userControl.mc64cljobs_encolados}" var="clh1">
<t:column id="col11">
<f:facet name="header" >
<h:outputText styleClass="leftColumn" value="Delete Work"/>
</f:facet>
<center>
<h:form>
<h:commandLink actionListener="#{userControl.eliminaTrabajo(clh1.codigo, 'multicore64clustalwtrabajos', userControl.user, userControl.password, clh1.fileSequences, '')}" value="Delete" />
</h:form>
</center>
</t:column>
<t:column id="col12">
<f:facet name="header" >
File Sequence Fasta
</f:facet>
<center>
<h:form>
<h:commandLink target="popupWindow" action="popupWindow" actionListener="#{userControl.setOpenFile(clh1.fileSequences)}" value="FILE 1" />
</h:form>
</center>
</t:column>
</t:dataTable>
</t:column>
<t:column id="col2" >
<f:facet name="header">
Pairwise alignment parameters
</f:facet>
<t:dataTable id="tabla3" value="#{userControl.mc64cljobs_encolados}" var="clh2" >
<t:column id="col21" >
<f:facet name="header" >
Gap Open Cost
</f:facet>
#{clh2.costeOpenGap}
</t:column>
<t:column id="col22">
<f:facet name="header">
Gap Extend Cost
</f:facet>
#{clh2.costeExtendGap}
</t:column>
<t:column id="col23">
<f:facet name="header" >
Cost Matrix
</f:facet>
#{clh2.scoringMatrix}
</t:column>
<t:column id="col24">
<f:facet name="header">
Cost Match/Replace
</f:facet>
#{clh2.costeMatchReplace}
</t:column>
</t:dataTable>
</t:column>
</h:dataTable>
What is my error in that code? What am I doing wrong?
Thank you so much!
Check this :
Why JSF calls getters multiple times
The getter can be called more than one times in jsf lifecycle
I am using richfaces 4, and i have a rich:datatable with a rich:datascroller and a column with a filter following the examples at the richfaces 4 showcase, but here's the thing, once i filter the table and the datascroller updates(ie. if at first the datascrolloer has 10 pages and after the filter have 2 pages) if I click on the next page or any of the boundary controls it suppose to go to the next page of the filtered table but instead the table resets to its original state(with out the filter expression)
here is my code:
<rich:dataTable id="mytbl" value="#{MyBean.mylist}" rows="10"
var="emp"
reRender="ds"
iterationStatusVar="it">
<f:facet name="noData">
no data found
</f:facet>
<rich:column filterValue="#{MyBean.id_filter}"
filterExpression="#{fn:containsIgnoreCase(emp.id,MyBean.id_filter)}">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="id"/>
<h:inputText value="#{MyBean.id_filter}">
<a4j:ajax event="change" render="mytbl" execute="#this"
onbegin="#{rich:component('wait_popup')}.show()"
oncomplete="#{rich:component('wait_popup')}.hide()"/>
</h:inputText>
</h:panelGroup>
</f:facet>
<h:outputText value="#{emp.id}"/>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="value" />
</f:facet>
<h:outputText value="#{emp.value}">
<f:convertNumber pattern="$#,###.00"/>
</h:outputText>
</rich:column>
<f:facet name="footer">
<rich:dataScroller maxPages="10" id="ds" render="#this" />
</f:facet>
</rich:dataTable>
Probably MyBean was not view scoped.