I have a table of checkboxes like Table of Row & Column Checkboxes
<ui:repeat value="#{userBean.gridRows}" var="tempRow">
<td>
<h:selectManyCheckbox class="cb_list">
<f:selectItem itemValue="#{tempRow}|rows" itemLabel="" />
</h:selectManyCheckbox>
</td>
</ui:repeat>
On the click of each checkbox i need to send the related info to ManagedBeans file, like if checkbox for Row A has been checked, i need to send the info that Row A has been selected.
This needs to be done without using JS and without the use of Button.
How to do that?
Related
This is regarding a JavaEE web application which uses JSF, JPA and Primefaces.
In a large JSF page, a table needs to be populated by a list of items. The first column display the name of the items as an output label. The second column has an input text to record user input. The third column displays a value which is calculated considering several factors and take a relatively long time.
I want to display the page with data for the first two columns, but the third Colum data need to be filled after the complete page is displayed to the user. This is to minimize the user waiting a long time before starting the data entry. As the user starts seeing the page, the third column needs to be populated as the data is made available.
Is this possible to be achieved in JSF? If needed I can use OminiPages, but not technologies like Spring and Struts.
<table>
<ui:repeat id="rptItems"
value="#{clientEncounterComponentItemController.items}"
var="ii" >
<tr>
<td>
<p:outputLabel for="itStC" value="#{ii.name}" ></p:outputLabel>
</td>
<td>
<p:inputText id="itStC" value="#{ii.shortTextValue}" >
</p:inputText>
</td>
<td>
<h:panelGroup rendered="#{ii.displayLastResult}" >
<p:outputLabel id="lblResult" value="#{clientEncounterComponentItemController.findFormsetValue(ii)}" ></p:outputLabel>
</h:panelGroup>
</td>
</tr>
</ui:repeat>
</table>
I'm using a web application with Prime Faces.
In my datatable, in which a column is an image, I've the pagination. So I never load too many rows.
For each row I've the button "delete row". Here the code
<p:dataTable id="dataTableUploadedImages" var="singleRow">
...
...
<p:column headerText="#{msg['azioni']}" width="70">
<div align="center">
<p:commandButton icon="ui-icon-trash"
title="delete Row"
ajax="true"
action="#{myController.deleteRow(singleRow.id)}"
update="dataTableUploadedImages">
</p:commandButton>
</div>
</p:column>
</p:dataTable>
After clicking over the button, the application refresh the entire table instead of simply remove the single row.
In this page, refreshing all the rows is expensive (because a column contains an image) and slow down the application.
Is it possible to remove a row without reloading the entire table?
Using
<p:dataTable
id="myissues"
value="{myIssuesController.myIssuesListModel.issueList}"
var="issueElement"
selection="#{issue}"
selectionMode="single"
rowKey="#{issueElement.idIssue}"
>
along with:
<p:ajax
event="rowSelect"
listener="#{myIssuesController.onSelectOneRow}"
update=":issueDetail"
oncomplete="PF('issueDetail').show();"
/>
I can open a dialog when I select a row on my dataTable.
How can I add an editable column to my table that goes into edition mode instead of opening the detail dialog when I click on one of its cells?
My first idea is to simply make the column editable and execute an oncomplete function that checks if the column selected is editable:
If it is, it will let it go into edition mode; if not it will call PF('issueDetail').show(); and show the detail dialog.
Only I don't know how to check if a particular column has been selected. How can I do that?
Should I do it like this or is there a simpler solution?
I solved using primefaces selection.
Basically, I removed the <p:ajax> component and added an extra column with a magnifier icon and a row editor icon to open the detail dialog / edit the entry; which is a more intuitive and user friendly solution than using the row selection action. The extra column looks like this:
<p:column style="width:32px;text-align: center">
<p:commandButton update=":issueDetail"
action="#{myIssuesController.onSelectOneRow}"
oncomplete="PF('issueDetail').show()"
icon="ui-icon-search" title="View" />
<p:rowEditor />
</p:column>
I have a dataTable with a list of employees.
One column of the dataTable is the names of the employees.
I want to have an inputText inside the header of the column which the user can use to filter the employees by their names, e.g. when the user writes "smi" in the inputText, the dataTable should only show the employees with the name starting with "smi" like Smith. The table data should update while the user is writing into the inputText, that is why I am using ajax here.
This is my column:
<h:column>
<f:facet name="header">Name
<h:form>
<h:inputText id="suchString" class="suchString"
value="#{mitarbeiteransicht.suchString}">
<f:ajax event="keyup" execute="suchString" render="ma-tabelle" />
</h:inputText>
</h:form>
</f:facet>
#{ma.bezeichnung}
</h:column>
ma-tabelle is my dataTable.
Everytime the table is rendered, the inputText inside the header is losing the focus and the user needs to click it again.
Is there a way around this? Is it possible to exclude the table headers when rerendering?
I have a p:selectOneMenu when its selection changes, some controls will be updated below. This works so far, but I added an empty selection placeholder. When this is chosen the validation fails and the content below is no more updated. So I want to do validation only when a button is clicked which submits the form but not when the p:selectOneMenu selection changes. How I can do this?
<p:selectOneMenu id="jobDetailClass" value="#{paramController.selectedJobClass}" styleClass="selectJobClass"
label="#{msgs['label.jobClass']}" converter="jobClassConverter" validator="#{paramController.validateJobClassSelection}">
<f:selectItems value="#{paramController.getAvailableJobClasses(paramEditMode)}" var="curJobClass"
itemLabel="#{curJobClass.name}" itemValue="#{curJobClass}"/>
<p:ajax event="change" process="#this" update="jobClassElemsGrid" />
</p:selectOneMenu>