上下文菜单和过滤器问题
Context menu and Filters issue
我试图在我的页面中同时使用上下文菜单和过滤器,但是在我过滤并重新加载页面后我得到了这个异常
启用选择后,DataModel 必须实现 org.primefaces.model.SelectableDataModel。
<p:dataTable
id="wtmInbox"
rendered="#{flowDashboardManagedBean.renderOnLoadForWtm}"
value="#{flowDashboardManagedBean.worktimematrixList}"
var="wtms"
stickyHeader="false"
tableStyleClass="IEListTable"
widgetVar="wtmInboxWidVar"
scrollable="true"
scrollHeight="700"
editable="true" rowKey="#{wtms.worktimematrix.workTimeMatrixId}" selection="#{flowDashboardManagedBean.selectedWorktimematrix}" selectionMode="single">
<p:ajax event="rowEdit" listener="#{flowDashboardManagedBean.onRowEdit}" update="wtmInbox"/>
<p:ajax event="contextMenu" listener="#{flowDashboardManagedBean.onRowSelect}" ></p:ajax>
过滤器:
<p:column headerText="#{bundle.status}"
sortBy="#{wtms.worktimematrix.workTimeMatrixStatus.name}"
filterBy="#{wtms.worktimematrix.workTimeMatrixStatus.name}"
filterMatchMode="exact"
style="text-align:right;"
priority="1"
width="10%">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{wtms.worktimematrix.workTimeMatrixStatus}" converter="workTimeMatrixStatusConverter"></h:outputText>
</f:facet>
<f:facet name="input">
<p:selectOneMenu value="#{wtms.worktimematrix.workTimeMatrixStatus}" converter="workTimeMatrixStatusConverter">
<f:selectItem itemLabel="#{bundle.select}" itemValue="#{null}"/>
<f:selectItems value="#{flowDashboardManagedBean.workTimeMatrixStatuses}" var="worktimematrixStatus" itemValue="#{worktimematrixStatus}" itemLabel="#{worktimematrixStatus.name}"></f:selectItems>
</p:selectOneMenu>
</f:facet>
</p:cellEditor>
<f:facet name="filter">
<p:selectOneMenu onchange="PF('wtmInboxWidVar').filter()" id="flowModelTypeFilter">
<f:selectItem itemLabel="#{bundle.status}" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{flowDashboardManagedBean.workTimeMatrixStatusNames}" var="status" itemValue="#{status}"/>
</p:selectOneMenu>
</f:facet>
</p:column>
发现问题,table 背后的实体没有实现可序列化。在我添加过滤器后,当我在上下文菜单中添加时,它也起作用了。
我试图在我的页面中同时使用上下文菜单和过滤器,但是在我过滤并重新加载页面后我得到了这个异常
启用选择后,DataModel 必须实现 org.primefaces.model.SelectableDataModel。
<p:dataTable
id="wtmInbox"
rendered="#{flowDashboardManagedBean.renderOnLoadForWtm}"
value="#{flowDashboardManagedBean.worktimematrixList}"
var="wtms"
stickyHeader="false"
tableStyleClass="IEListTable"
widgetVar="wtmInboxWidVar"
scrollable="true"
scrollHeight="700"
editable="true" rowKey="#{wtms.worktimematrix.workTimeMatrixId}" selection="#{flowDashboardManagedBean.selectedWorktimematrix}" selectionMode="single">
<p:ajax event="rowEdit" listener="#{flowDashboardManagedBean.onRowEdit}" update="wtmInbox"/>
<p:ajax event="contextMenu" listener="#{flowDashboardManagedBean.onRowSelect}" ></p:ajax>
过滤器:
<p:column headerText="#{bundle.status}"
sortBy="#{wtms.worktimematrix.workTimeMatrixStatus.name}"
filterBy="#{wtms.worktimematrix.workTimeMatrixStatus.name}"
filterMatchMode="exact"
style="text-align:right;"
priority="1"
width="10%">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{wtms.worktimematrix.workTimeMatrixStatus}" converter="workTimeMatrixStatusConverter"></h:outputText>
</f:facet>
<f:facet name="input">
<p:selectOneMenu value="#{wtms.worktimematrix.workTimeMatrixStatus}" converter="workTimeMatrixStatusConverter">
<f:selectItem itemLabel="#{bundle.select}" itemValue="#{null}"/>
<f:selectItems value="#{flowDashboardManagedBean.workTimeMatrixStatuses}" var="worktimematrixStatus" itemValue="#{worktimematrixStatus}" itemLabel="#{worktimematrixStatus.name}"></f:selectItems>
</p:selectOneMenu>
</f:facet>
</p:cellEditor>
<f:facet name="filter">
<p:selectOneMenu onchange="PF('wtmInboxWidVar').filter()" id="flowModelTypeFilter">
<f:selectItem itemLabel="#{bundle.status}" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{flowDashboardManagedBean.workTimeMatrixStatusNames}" var="status" itemValue="#{status}"/>
</p:selectOneMenu>
</f:facet>
</p:column>
发现问题,table 背后的实体没有实现可序列化。在我添加过滤器后,当我在上下文菜单中添加时,它也起作用了。