When I update a datatable with Id it work's but when I update a table (without id) all my lines on the datatable are selected even being selectionMode="single". Why ?
Thank's.
Update datatable - without Id
-
- Posts: 51
- Joined: 06 Sep 2010, 23:01
- Location: São Paulo - Brazil
How are you trying to update withou id? Are you using "@form" ?
Post the code please.
Post the code please.
Mojarra 2.0.2 (FCS b10)
GlassFish 3.0.1
PrimeFaces 2.2.1
GlassFish 3.0.1
PrimeFaces 2.2.1
Code: Select all
<p:dataTable value="#{bean.lista}"
selectionMode="single"
id="endTabela"
var="end"
selection="#{bean.person}"
update="endTabela"
>
public class Person implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name="name", length=100, nullable=true)
private String name;
Code: Select all
<p:commandButton action="#{bean.remove}"
value="Remover" immediate="true">
</p:commandButton>
public void remove(){
list.remove(person);
}
Mojarra 2.1.6; GlassFish 3.1.2.2; PrimeFaces 4.0-SNAPSHOT
Brasil
Brasil
-
- Posts: 51
- Joined: 06 Sep 2010, 23:01
- Location: São Paulo - Brazil
Sorry, but I didn't understand it very well. I guess you don't need to use update="endTabela" in the dataTable, and even use the person.id
The remove() is working? This method is being executed when you click the button?
Take a look at the showcase example : http://www.primefaces.org/showcase/ui/d ... Single.jsf
it might help.
The remove() is working? This method is being executed when you click the button?
Take a look at the showcase example : http://www.primefaces.org/showcase/ui/d ... Single.jsf
it might help.
Mojarra 2.0.2 (FCS b10)
GlassFish 3.0.1
PrimeFaces 2.2.1
GlassFish 3.0.1
PrimeFaces 2.2.1
Hi,
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.
Here is what is sent during the Ajax call (one of the spinner changed):
And here is the response received from the server (notice the tag in response: <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
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.
Code: Select all
<h:form id="frm">
<table>
<tr>
<td>
<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>
</td>
<td width="50"><h:outputText value=" " /></td>
<td>
<p:dataTable id="hoursTable" var="hour" value="#{cc.attrs.selectedHours.hours}" rows="7" style="width: 300px" emptyMessage="Closed">
<p:column>
<f:facet name="header">
<h:outputText value="Opening" />
</f:facet>
<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:outputText value=" : " />
<p:spinner value="#{hour.fromMinute}" maxlength="2" size="2" stepFactor="5" min="0" max="59">
<p:ajax process="@form" update="#{cc.clientId}:frm:openingHoursTbl" event="change" />
</p:spinner>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Closing" />
</f:facet>
<p:spinner value="#{hour.toHour}" maxlength="2" size="2" stepFactor="1" min="0" max="23">
<p:ajax process="@form" update="#{cc.clientId}:frm:openingHoursTbl" event="change" />
</p:spinner>
<h:outputText value=" : " />
<p:spinner value="#{hour.toMinute}" maxlength="2" size="2" stepFactor="5" min="0" max="59">
<p:ajax process="@form" update="#{cc.clientId}:frm:openingHoursTbl" event="change" />
</p:spinner>
</p:column>
</p:dataTable><br/>
<h:commandButton value="Add">
<f:ajax execute="@form" listener="#{cc.attrs.addRange}" render="hoursTable" event="click" />
</h:commandButton>
</td>
</tr>
</table>
</h:form>
Code: Select all
j_idt162:frm j_idt162:frm
j_idt162:frm:openingHoursTbl_selection 0
j_idt162:frm:hoursTable:0:j_idt149 1
j_idt162:frm:hoursTable:0:j_idt151 5
j_idt162:frm:hoursTable:0:j_idt154 0
j_idt162:frm:hoursTable:0:j_idt156 0
javax.faces.ViewState 8248512111669847648:5360384544614039404
javax.faces.partial.ajax true
javax.faces.source j_idt162:frm:hoursTable:0:j_idt151
javax.faces.partial.execute j_idt162:frm
javax.faces.partial.render j_idt162:frm:openingHoursTbl
javax.faces.behavior.event change
Code: Select all
<partial-response>
<changes>
<update id="j_idt162:frm:openingHoursTbl">
<div id="j_idt162:frm:openingHoursTbl" class="ui-datatable ui-widget"
style="width: 300px">
<table>
<thead>
<tr>
<th id="j_idt162:frm:openingHoursTbl:j_idt139" class="ui-state-default">Day</th>
<th id="j_idt162:frm:openingHoursTbl:j_idt142" class="ui-state-default">Opening
Hours</th>
</tr>
</thead>
<tbody id="j_idt162:frm:openingHoursTbl_data" class="ui-datatable-data">
<tr id="j_idt162:frm:openingHoursTbl_row_0"
class="ui-widget-content ui-datatable-even ui-selected ui-state-highlight">
<td>Monday</td>
<td>
<span id="j_idt162:frm:openingHoursTbl:0:ohHeader">01:05 - 00:00 </span>
</td>
</tr>
<tr id="j_idt162:frm:openingHoursTbl_row_1"
class="ui-widget-content ui-datatable-odd ui-selected ui-state-highlight">
<td>Tuesday</td>
<td>
<span id="j_idt162:frm:openingHoursTbl:1:ohHeader">Closed</span>
</td>
</tr>
<tr id="j_idt162:frm:openingHoursTbl_row_2"
class="ui-widget-content ui-datatable-even ui-selected ui-state-highlight">
<td>Wednesday</td>
<td>
<span id="j_idt162:frm:openingHoursTbl:2:ohHeader">Closed</span>
</td>
</tr>
<tr id="j_idt162:frm:openingHoursTbl_row_3"
class="ui-widget-content ui-datatable-odd ui-selected ui-state-highlight">
<td>Thursday</td>
<td>
<span id="j_idt162:frm:openingHoursTbl:3:ohHeader">Closed</span>
</td>
</tr>
<tr id="j_idt162:frm:openingHoursTbl_row_4"
class="ui-widget-content ui-datatable-even ui-selected ui-state-highlight">
<td>Friday</td>
<td>
<span id="j_idt162:frm:openingHoursTbl:4:ohHeader">Closed</span>
</td>
</tr>
<tr id="j_idt162:frm:openingHoursTbl_row_5"
class="ui-widget-content ui-datatable-odd ui-selected ui-state-highlight">
<td>Saturday</td>
<td>
<span id="j_idt162:frm:openingHoursTbl:5:ohHeader">Closed</span>
</td>
</tr>
<tr id="j_idt162:frm:openingHoursTbl_row_6"
class="ui-widget-content ui-datatable-even ui-selected ui-state-highlight">
<td>Sunday</td>
<td>
<span id="j_idt162:frm:openingHoursTbl:6:ohHeader">Closed</span>
</td>
</tr>
</tbody>
</table>
<input type="hidden" id="j_idt162:frm:openingHoursTbl_selection"
name="j_idt162:frm:openingHoursTbl_selection" value="0,1,2,3,4,5,6" />
</div>
<script type="text/javascript">widget_j_idt162_frm_openingHoursTbl = new
PrimeFaces.widget.DataTable('j_idt162:frm:openingHoursTbl',{url:'/bt/admin/businessEdition.faces',formId:'j_idt162:frm',selectionMode:'single',instantSelect:true,onRowSelectUpdate:'j_idt162:frm:hoursTable'});</script>
</update>
<update id="javax.faces.ViewState">8248512111669847648:5360384544614039404</update>
</changes>
<extension primefacesCallbackParam="validationFailed">{"validationFailed":false}</extension>
</partial-response>
-
- Information
-
Who is online
Users browsing this forum: No registered users and 21 guests