为什么我的数据表的数据在我使用过滤器然后重新加载页面时没有出现?
Why the data of my datatable doesn't apper when I use filter and then reload the page?
我有一个包含数据和过滤器的数据表
过滤器工作得很好,当我白色一些不存在的数据时,数据表是空的,但是当我重新加载页面时,数据确实显示在数据表中
这是我的代码
XHTML
<p:tab title="#{caseList['caseManagement.assignedToMe']}" id="myCaseTab">
<p:dataTable var="myCase" id="myCases"
value="#{caseManagement.myWork}"
widgetVar="myCaseTable"
row="5"
paginator="true"
rowsPerPageTemplate="5,10,15"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="({currentPage} #{caseList['caseManagement.paginator.of']} {totalPages})"
emptyMessage="#{caseList['caseManagement.emptyList']}"
filteredValue="#{caseManagement.filteredMyWork}"
paginatorPosition="top">
豆子
private List<Case> myWork = new ArrayList<Case>(); //get and set
private List<Case> work = new ArrayList<Case>(); //get and set
private int sizefilteredMyWork; //get and set
private int sizeFilteredAllWork; //get and set
private List<Case> filteredMyWork; //get and set
private List<Case> filteredAllWorks; //get and set
private Case selectedCase; //get and set
public CaseManagementBean()
{
init();
}
public void init()
{
addElementToMyWork();
addElementToWork();
setSizeFilteredAllWork(work.size());
setSizefilteredMyWork(myWork.size());
}
我该如何解决?
编辑
public void addElementToMyWork()
{
// FIXME: llenado de lista temporal hasta acceder a oriden de datos
getMyWork().add(
new Case(null, "John Smith Address", null, null, null, "Collect Evidence", "Manual Investigation", "Company #1",
null, null, null, null));
getMyWork().add(
new Case(null, "3rd Division Incorrect Drivers License N° 77288282", null, null, null, "Decision Making",
"Manual Investigation", "Company #7", null, null, null, null));
getMyWork().add(
new Case(null, "Double Fraud Alert Cloned Address 8892911", null, null, null, "Evidence", "Manual Investigation",
"Company #1", null, null, null, null));
getMyWork().add(
new Case(null, "Miami Gateway Credit Fault", null, null, null, "Evidence", "Manual Investigation", "Company #6",
null, null, null, null));
}
public void addElementToWork()
{
// FIXME: llenado de lista temporal hasta acceder a oriden de datos
getWork().add(
new Case(null, "John Smith Address", null, null, "Calvin Smith", "Collect Evidence", "Manual Investigation",
"Company #1", null, null, null, null));
getWork().add(
new Case(null, "3rd Division Incorrect Driver Licence Nº 77288282", null, null, "John Snack", "Collect Evidence",
"Manual Investigation", "Company #6", null, null, null, null));
getWork().add(
new Case(null, "Double Fraud Alert Cloned Address 8892911", null, null, "-", "Collect Evidence",
"Manual Investigation", "Company #4", null, null, null, null));
getWork().add(
new Case(null, "Miami Gateway Credit Fault", null, null, "Rajesh Bonganay", "Decision Making",
"Manual Investigation", "Company #7", null, null, null, null));
}
尝试清除会话(或视图状态),然后再将其填充到过滤器的事件处理程序中。也许当你刷新 table 中的数据正在被缓存(或者在这种情况下缺少数据)。
解决方案是只使用一个列表进行显示和过滤
所以你必须删除
filteredValue="#{caseManagement.filteredMyWork}"
我有一个包含数据和过滤器的数据表
过滤器工作得很好,当我白色一些不存在的数据时,数据表是空的,但是当我重新加载页面时,数据确实显示在数据表中
这是我的代码
XHTML
<p:tab title="#{caseList['caseManagement.assignedToMe']}" id="myCaseTab">
<p:dataTable var="myCase" id="myCases"
value="#{caseManagement.myWork}"
widgetVar="myCaseTable"
row="5"
paginator="true"
rowsPerPageTemplate="5,10,15"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="({currentPage} #{caseList['caseManagement.paginator.of']} {totalPages})"
emptyMessage="#{caseList['caseManagement.emptyList']}"
filteredValue="#{caseManagement.filteredMyWork}"
paginatorPosition="top">
豆子
private List<Case> myWork = new ArrayList<Case>(); //get and set
private List<Case> work = new ArrayList<Case>(); //get and set
private int sizefilteredMyWork; //get and set
private int sizeFilteredAllWork; //get and set
private List<Case> filteredMyWork; //get and set
private List<Case> filteredAllWorks; //get and set
private Case selectedCase; //get and set
public CaseManagementBean()
{
init();
}
public void init()
{
addElementToMyWork();
addElementToWork();
setSizeFilteredAllWork(work.size());
setSizefilteredMyWork(myWork.size());
}
我该如何解决?
编辑
public void addElementToMyWork()
{
// FIXME: llenado de lista temporal hasta acceder a oriden de datos
getMyWork().add(
new Case(null, "John Smith Address", null, null, null, "Collect Evidence", "Manual Investigation", "Company #1",
null, null, null, null));
getMyWork().add(
new Case(null, "3rd Division Incorrect Drivers License N° 77288282", null, null, null, "Decision Making",
"Manual Investigation", "Company #7", null, null, null, null));
getMyWork().add(
new Case(null, "Double Fraud Alert Cloned Address 8892911", null, null, null, "Evidence", "Manual Investigation",
"Company #1", null, null, null, null));
getMyWork().add(
new Case(null, "Miami Gateway Credit Fault", null, null, null, "Evidence", "Manual Investigation", "Company #6",
null, null, null, null));
}
public void addElementToWork()
{
// FIXME: llenado de lista temporal hasta acceder a oriden de datos
getWork().add(
new Case(null, "John Smith Address", null, null, "Calvin Smith", "Collect Evidence", "Manual Investigation",
"Company #1", null, null, null, null));
getWork().add(
new Case(null, "3rd Division Incorrect Driver Licence Nº 77288282", null, null, "John Snack", "Collect Evidence",
"Manual Investigation", "Company #6", null, null, null, null));
getWork().add(
new Case(null, "Double Fraud Alert Cloned Address 8892911", null, null, "-", "Collect Evidence",
"Manual Investigation", "Company #4", null, null, null, null));
getWork().add(
new Case(null, "Miami Gateway Credit Fault", null, null, "Rajesh Bonganay", "Decision Making",
"Manual Investigation", "Company #7", null, null, null, null));
}
尝试清除会话(或视图状态),然后再将其填充到过滤器的事件处理程序中。也许当你刷新 table 中的数据正在被缓存(或者在这种情况下缺少数据)。
解决方案是只使用一个列表进行显示和过滤
所以你必须删除
filteredValue="#{caseManagement.filteredMyWork}"