I have a datatable with rowedit. One column of my table is a cell with a listbox in, the items of the listbox are dynamically retrieved (depending on the value in another cell) I use rowEditInit to set the selectedrow item. And I want to update the listbox to retrieve the correct values. This does not work. When I do
<p:ajax event="rowEditInit" listener="#{workOrderDetail.onEdit}" update="orderitemstable" />
Then when I click the pencil icon, the I can see the row switch to edit mode and retriving the listbox items. But it directly swithced back to non edit mode.
But when I do
<p:ajax event="rowEditInit" listener="#{workOrderDetail.onEdit}" update="rmactionenumid" />
Then clicking the pencil icon puts the row in edit mode, but no call is made to retrieve the listbox items. My gues is, it does not trigger the update on rmactionenumid.
Any ideas?
Roel
Here is my jsf code
<p:ajax event="rowEditInit" listener="#{workOrderDetail.onEdit}" update="rmactionenumid" />
<p:column >
<p:cellEditor>
<f:facet name="output">
<h:outputText id="rmactionenumidlabel" value="#{orderItem.rmActionRepr}" >
</h:outputText>
</f:facet>
<f:facet name="input">
<h:selectOneListbox id="rmactionenumid" value="#{orderItem.rmActionEnumId}" size="1" valueChangeListener="#{workOrderDetail.setActionRepr}">
<f:selectItems value="#{workOrderDetail.actionItems}"/>
<p:ajax event="change" update="partdiscount,labourdiscount,totalprice,:detail:wodetail:totals" execute="@this" />
</h:selectOneListbox>
</f:facet>
</p:cellEditor>
</p:column>
<p:column >
<p:rowEditor id="edit" />
</p:commandLink>
</p:column>
</p:dataTable>
and here is my java bean code
public List<SelectItem> getActionItems() throws MWSException {
ArrayList<SelectItem> actions = new ArrayList<SelectItem>();
if (getSelectedOrderItem() != null) {
ListManager lm = new ListManager(getWA().getMwsProxy());
MWSGenericMapList items = lm.nativeSearch(getWS().getUser(), HdfWebConstants.NS_VEHICLEPARTACTIONS, 0, 0, 200,
false, getSelectedOrderItem().getVehiclePartCode());
for (int i = 0; i < items.size(); i++) {
actions.add(new SelectItem(items.get(i).get("rmaction_enumid").toString(), items.get(i).get("rmaction")
.toString()));
}
}
return actions;
}
public void setSelectedOrderItem(IMWSOrderItem newSelectedOrderItem) throws MWSException {
this.selectedOrderItem = newSelectedOrderItem;
}
public void onEdit(RowEditEvent event) throws MWSException {
setSelectedOrderItem((IMWSOrderItem) event.getObject());
}
I'm using PF3.5
valueChangeListener
andp:ajax
at same time atselectOneListbox
? You have a lot of code which can be issuing your functionality, for example you callonEdit
when you begin the editing and when you finish it. Is it really useful? Furthermore, you posted two columns with similar content, I suggest you trying to isolate the concrete problem by yourself. If you still continue with the problem, then post it here in a preferable SSCCE style which can be copy-pasted and run. Otherwise, it's so complicated to see the concrete issue. – Xtreme Biker