I have the same issue with primefaces 2.2.1 I use Spinner component with Ajax. For each change on the spinner I want to update a (primefaces) DataTable component. And I don't know why, each time I update datatable, all rows are selected even though selectionMode="single" and selection takes a parameter which is a POJO and not a list. This happens in a composite implementation.
<h:form id="frm">
(...)
<p:dataTable id="openingHoursTbl" var="oh" value="#{cc.attrs.openingHours}" rows="7"
selection="#{cc.attrs.selectedHours}" selectionMode="single"
onRowSelectUpdate="hoursTable"
style="width: 300px">
<p:column>
<f:facet name="header">
开发者_开发问答<h:outputText value="Day" />
</f:facet>
<h:outputText value="#{oh.displayedDays}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Opening Hours" />
</f:facet>
<h:outputText id="ohHeader" value="#{oh.displayedHours}" />
</p:column>
</p:dataTable>
(...)
<p:spinner value="#{hour.fromHour}" maxlength="2" size="2" stepFactor="1" min="0" max="23">
<p:ajax process="@form" update="#{cc.clientId}:frm:openingHoursTbl" event="change" />
</p:spinner>
(...)
</h:form>
Here is the response received from the server (notice that selection input tag have all rows selected):
<partial-response>
<changes>
<update id="j_idt162:frm:openingHoursTbl">
<div id="j_idt162:frm:openingHoursTbl" class="ui-datatable ui-widget"
style="width: 300px">
<table>
(...)
</table>
<input type="hidden" id="j_idt162:frm:openingHoursTbl_selection"
name="j_idt162:frm:openingHoursTbl_selection" value="0,1,2,3,4,5,6" />
(...)
Thanks for your help
Old question but I recently had a similar problem so it might help someone else who has the same problem. The issue I had was when deleting a row, so not quite the same but anyhow.
I had to reset the "selected value" when I deleted a row. So I guess this could be avoided by updating the data set you're working with.
精彩评论