a4j:commandLink working intermittently - status

In the code below, a4j:commandLink (with id id="account-link") does not work for me all the time.
Fail Scenario (happens 1 out of approx 10 clicks) : Its clicked, the a4j:status tag (we show a moving wait bar) is invoked but the backing bean is not called. Below is the entire code. The backing bean is conversation scope.
<rich:dataTable id="accountsDataTable" value="#{accounts}" var="acct"
styleClass="data-table" rowClasses="odd,even"
sortMode="single"
rows="50" rendered="#{accounts != null and accounts.rowCount>0}">
<rich:column id="col1" sortable="true" sortBy="#{acct.customerAccountId}">
<f:facet name="header">Account Number</f:facet>
<a4j:region id="account-link-zone">
<c:choose>
<c:when test="#{identity.isBackOffice}">
<a4j:commandLink action="#{accountSearch.getAndBypassAccount(acct.customerAccountId)}"
value="#{acct.customerAccountId}" eventsQueue="accountSearchQueue"
styleClass="left"/>
</c:when>
<c:otherwise>
<a4j:commandLink action="#{accountVerificationAction.getAccountToVerify(acct.customerAccountId)}"
id="account-link"
reRender="verificationModal"
ajaxSingle="true"
value="#{acct.customerAccountId}" eventsQueue="accountSearchQueue"
styleClass="left" limitToList="true"/>
</c:otherwise>
</c:choose>
</a4j:region>
<a4j:status startStyle="left" id="account-link-status" for="account-link-zone">
<f:facet name="start">
<img alt="status" src="../../img/spinner-inline.gif"/>
</f:facet>
<f:facet name="stop">
</f:facet>
</a4j:status>
</rich:column>

Related

Primefaces: DataTable selection checkbox is not working without a theme

Sorry for my english. I use primefaces without a theme.
In web.xml:
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>none</param-value>
</context-param>
And I use empty primefaces.css.
I want to use dataTable with selectionMode:
<h:form id="form">
<p:dataTable id="testTableId" var="testTable" value="#{testMB.entityList}"
selection="#{testMB.selectedList}" rowKey="#{testTable.id}"
tableStyleClass="table table-hover table-bordered">
<p:column selectionMode="multiple" style="width:16px;text-align:center"/>
<p:column headerText="testName">
#{testTable.name}
</p:column>
<f:facet name="footer">
<p:commandButton process="testTableId" update="#form" icon="ui-icon-search" value="test"/>
</f:facet>
</p:dataTable>
<ui:repeat value="#{testMB.selectedList}" var="selectedList" id="ddddddddddd">
<h:outputText value="#{selectedList.id} - #{selectedList.name}"/>
</ui:repeat>
</h:form>
I click on a checkbox and click on commandButton test. But it is not working. List #{testMB.selectedList} is empty.
But if I click on a row (not on the checkbox) and for multiple selection I use ctrl then it is working.
If I use default theme, then checkbox is working.
Why is not working when I click on a checkbox without a theme.

Scrollbar for outputLabel

I want to implment a scrollbar for a outputLabel but if i use scrollbar component it put every list elment in a new row. The whole output should be disyplayed in one row and the list should be scrollable. Can i fix this problem with a CSS attribute?
i use primefaces 4.0 and jsf 2.1
here is my code
<p:commandButton id="newMessage" update=":contentForm"
actionListener="#{taskboxBean.newMessage}" value="New Message" />
<p:commandButton id="trash"
update=":contentForm, :postForm:tabViewPosts:trashTable, :postForm:tabViewPosts:inboxTable, :postForm:tabViewPosts:sentTable"
actionListener="#{taskboxBean.deleteSelectedTaskbox}" icon="ui-icon-trash" title="Trash" />
<p:scrollPanel>
<ui:repeat var="task_to_user" value="#{taskboxBean.selectedTaskbox.TASKBOX_TO_USERS}">
<p:outputLabel
value="#{task_to_user.USER.EMAIL} #{task_to_user.USER.FIRST_NAME} #{task_to_user.USER.LAST_NAME} #{task_to_user.USER.FIRST_NAME}" />
</ui:repeat>
</p:scrollPanel>
<h:outputText value="#{taskboxBean.selectedTaskbox.TASKTYPE.NAME} " />
<h:outputText value="#{taskboxBean.selectedTaskbox.CREATE_TIMESTAMP} " />

Hide empty header of primefaces subtable

I have a set of subtables that is fed from the managed bean, and they may or may not have a header text.
<p:dataTable var="xxxxx" value="#{}" styleClass="xxxxx" emptyMessage="#{}">
<f:facet name="header">#{}</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column headerText="xxxxx" />
</p:row>
</p:columnGroup>
<p:subTable var="xxxxx" value="#{}">
<f:facet name="header">
<h:outputText rendered="#{}"
value="#{}" />
</f:facet>
<p:column style="text-align:center;">
<h:outputText value="#{}" />
</p:column>
</p:column>
</p:subTable>
</p:dataTable>
Only structure shown. Tag contents wiped on purpose.
when the subtable header is empty text, it still renders a thin empty header line. Is there any way I can supress the exibition of that header in case empty?
Using PF 3.5 on Tomcat 7 (mojarra)
Supress the exibition of the empty header of the subtable by using this CSS property:
td.ui-datatable-subtable-header:empty {
display: none
}

reRender a specific row of rich:dataTable

Good Morning!
Is it possible to reRender only 1 specific row of rich:dataTable?
I have a rich:dataTable and, when I do something that I´m sure only 1 row has changed, I need to reRednder only this row, not the entire table. Is it possible? How?
XHTML:
<rich:dataTable id="myTable" value="#{bean.table}" var="me">
<rich:column>
<h:outputText value="#{me.id}" />
</rich:column>
<rich:column>
<h:outputText value="#{me.valueOne}" />
</rich:column>
<rich:column>
<h:outputText value="#{me.valueTwo}" />
</rich:column>
</rich:dataTable>
<some:tag.... reRender="??????" action="bean.example" />
Java:
public void example{
// Do something that affects to the row selected
}
THANK YOU VERY MUCH.
Yes , it is possible . You have to specify the followings things:
Which columns to be rendered via the reRender attribute of the tags that can invoke MBean method
What rows to be rendered via the ajaxKeys attribute of the rich:dataTable .
The ajaxKeys attribute is bound to Set <Integer> Object which holds the row numbers to be updated.
For example , suppose you want to invoke a Mbean method using a4j:commandButton and want to render a particular row and column after the action finishes . You can use the following :
<a4j:commandButton action="#{bean.someAction}" reRender="columnID,columnID2">
<f:setPropertyActionListener value="#{idx}" target="#{bean.selectedRow}" />
</a4j:commandButton>
<rich:dataTable id="myTable" value="#{bean.table}" var="me" ajaxKeys="#{bean.rowsToUpdate}" rowKeyVar="idx">
<rich:column id="columnID">
<h:outputText value="#{me.id}" />
</rich:column>
<rich:column id="columnID2">
<h:outputText value="#{me.valueOne}" />
</rich:column>
<rich:column>
<h:outputText value="#{me.valueTwo}" />
</rich:column>
</rich:dataTable>
Inside the bean.someAction() , you add the row number that you want to update to the rowsToUpdate integer set:
HashSet<Integer> rows = new HashSet<Integer>();
rows.add(selectedRow);
setRowsToUpdate( rows );

Display sub-property in table tag (Spring Roo supplied tag library)

I am using Spring Roo. There is table:table and table:column tags.
How to display sub-property of colections elements in table?
In straightforward way it doesnt work:
<table:table data="${knowledgebase.concepts}" id="l_domain_Concept" path="/concepts" z="user-managed">
<table:column id="c_domain_Concept_translations" property="defaultTranslation.name" z="user-managed" />
</table:table>
Exception:
Caused by: javax.el.PropertyNotFoundException: Property 'defaultTranslation.name' not found on type domain.data.Concept
I modified table.tagx so it could be used with sub-properties and Spring converting capabilities.
<c:forTokens items="${columnProperties}" delims="," var="column" varStatus="num">
<c:set var="prop" value="${ item }" />
<c:forTokens items="${column}" delims="." var="subprop">
<c:set var="prop" value="${ prop[subprop]}" />
</c:forTokens>
<c:set var="columnMaxLength" value="${lengths[num.count - 1]}" scope="request"/>
<td>
<c:choose>
<c:when test="${not convert}">
<c:out value="${columnMaxLength lt 0 ? prop : fn:substring(prop, 0, columnMaxLength)}" />
</c:when>
<c:otherwise>
<spring:eval expression="prop" />
</c:otherwise>
</c:choose>
</td>
Edit PROJECT/src/main/webapp/WEB-INF/tags/form/fields/table.tagx. At line 78, you should see <c:set var="columnDatePattern" value="${patterns[num.count-1]}" />. Put under that line, the following piece of code:
<!-- Get the last descendant property -->
<c:set var="prop" value="${item}" />
<c:forTokens items="${column}" delims="." var="subprop">
<c:if test="${not empty prop}">
<c:set var="prop" value="${prop[subprop]}" />
</c:if>
</c:forTokens>
<!-- Now under tag c:choose below, please change from "item[column]" into "prop" -->
<!-- // End of Get the last descendant property. -->
Don't forget to change from "item[column]" into "prop". For example, the changed lines should be:
<c:choose>
<c:when test="${columnType eq 'date'}">
<spring:escapeBody>
<fmt:formatDate value="${prop}" pattern="${fn:escapeXml(columnDatePattern)}" var="colTxt" />
</spring:escapeBody>
</c:when>
<c:when test="${columnType eq 'calendar'}">
<spring:escapeBody>
<fmt:formatDate value="${prop.time}" pattern="${fn:escapeXml(columnDatePattern)}" var="colTxt"/>
</spring:escapeBody>
</c:when>
<c:otherwise>
<c:set var="colTxt">
<spring:eval expression="prop" htmlEscape="false" />
</c:set>
</c:otherwise>
</c:choose>
You can edit entity file Concepts.java :
#Transient
public String getDefaultTranslationName(){
return defaultTranslation.getName();
}
After , you edit to:
<table:column id="c_domain_Concept_translations" property="DefaultTranslationName" z="user-managed" />
Hope can help you !

Resources