DataTable: filtering breaks row-state / action-listener call with current var
See original GitHub issueActual:
- filter by “2”
- click button: “doSomething: 0” is printed
Actual:
- filter by “2”
- click button: “doSomething: 2” should be printed
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>PrimeFaces Test</title>
</h:head>
<h:body>
<h:form id="frmTest">
a#{testView.entries}a
<p:dataTable value="#{testView.entries}" filteredValue="#{testView.filteredEntries}" var="entry">
<p:column field="id" />
<p:column field="name1" />
<p:column field="name2" />
<p:column>
<p:commandButton process="@this" update="@none" actionListener="#{testView.doSomething(entry)}" value="Action" />
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
package org.primefaces.test;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import javax.faces.bean.ViewScoped;
import javax.inject.Named;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Named
@ViewScoped
public class TestView implements Serializable {
private List<Entry> filteredEntries;
public List<Entry> getEntries() {
return Arrays.asList(new Entry(1, "1", "1"), new Entry(2, "2", "2"), new Entry(3, "3", "3"));
}
public List<Entry> getFilteredEntries() {
return filteredEntries;
}
public void setFilteredEntries(List<Entry> filteredEntries) {
this.filteredEntries = filteredEntries;
}
public void doSomething(Entry entry) {
System.err.println("doSomething: " + entry.getId());
}
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class Entry {
private int id;
private String name1;
private String name2;
@Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + Objects.hashCode(this.id);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Entry other = (Entry) obj;
if (!Objects.equals(this.id, other.id)) {
return false;
}
return true;
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Button click fired multiple times when performing filtering
Hello, I've a datatable with 2 button as first row. The data are retrieved via ajax and there're footer input to filter on...
Read more >PrimeFaces, Issues with Datatable Filtering + Ajax table update
I have constructed a Datatable that uses Filters for one columns and selectable row along with a context menu. This seems to create...
Read more >DataTable.Select Method (System.Data) - Microsoft Learn
Gets an array of all DataRow objects that match the filter criteria. Select(String, String) ... private void GetRows() { // Get the DataTable...
Read more >[closed]DataTable with Filter actionlistener not working
Hello i have a DataTable with a commandButton on the last Column in every Row. The CommandButton call a Method in a SessionScoped...
Read more >Filtering Syntax | Dash for Python Documentation | Plotly
dash_table.DataTable` is an interactive table that supports rich styling, conditional formatting, editing, sorting, filtering, and more.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
added a comment here #7336 i feel my customers problem is somehow different but related
@potop it has been marked with the “Elite” label so PrimeTek usually reviews those for Elite releases so hopefully it will go in 10.0.4.