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>
Related
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?
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 am using primefaces 3.5
I have a p:selectonemenu in one of the column in datatable. and also I have a submit button on another column of same datatable. When I do a submit the row will get removed.
Here when I am selecting 'Other' then do a submit action and updating the form, the p:selectonemenu items in other rows is getting 'other' as first value. What is way to set 'other' to last value everytime
<p:column headerText="Buyer Response" style="white-space:pre-line;">
<p:selectOneMenu value="#{buyerInProcessBean.subject}"
id="buyerResponseId" >
<f:selectItems
value="#{buyerInProcessBean.subjectMap[trans.decisionrule.ruleId]}"
var="subject" itemLabel="#{subject}" itemValue="#{subject}"></f:selectItems>
<f:selectItem itemLabel="Other" itemValue="Other" ></f:selectItem>
</p:selectOneMenu>
</p:column>
Since you have
<p:selectOneMenu value="#{buyerInProcessBean.subject}">
The subject is shared between all rows, of course, other select menus will have the same value as the one selected (other in your case). For that, I suggest a simple fix, you have to move the subject attribute to the objects you are iterating on.
Another fix, is to set the subject attribute to "Other" once your method executed on submit is finished. But with this, even the changed selectmenu will lose "Other" as value.
So in conclusion, you have to change your logic, so that subject won't be shared between rows
is it possible to preselect a cell in the Primefaces DataTable component? How do I do that? Tried it already with a Primefaces Cell object with a Getter, but this is not called by my data table :-(.
I need this because I have to restore the selection of the cell done a request before, if validation tells me, that a required field in the form was not filled.
This is my xhtml code snippet:
<p:dataTable id="select-start-pos" var="item"
selectionMode="singlecell"
value="#{frankingController.startposItems}"
selection="#{frankingController.selectedCell}"
styleClass="startPosGrid">
<p:column id="startposcol1">
<h:outputText value=""/>
</p:column>
<p:column id="startposcol2" rendered="#{frankingController.startposColumns > 1}">
<h:outputText value=""/>
</p:column>
</p:dataTable>
Thank you for your help!
Mike
No and 3.x doesn't have cell selection feature
You can use Sheet control instead of Datatable, it has row selection feature.
http://www.primefaces.org/showcase-labs/ui/sheet.jsf