Primefaces 3.5在dataTable上引入了multisort。但它有一個分頁錯誤。Primefaces 3.5 multisort在分頁失敗..我們有修復嗎?
每次按paginator按鈕時,表格初始渲染時設置的排序列(col的sortMeta obj)將發送到裝入方法,而不是選定的排序列。如果初始sortOrder未設置,則發送null。
是否有解決此問題的方法?有誰知道這是否已在任何Elite版本中修復?或者如果有解決方法?
需要一些緊急幫助。
感謝
Primefaces 3.5在dataTable上引入了multisort。但它有一個分頁錯誤。Primefaces 3.5 multisort在分頁失敗..我們有修復嗎?
每次按paginator按鈕時,表格初始渲染時設置的排序列(col的sortMeta obj)將發送到裝入方法,而不是選定的排序列。如果初始sortOrder未設置,則發送null。
是否有解決此問題的方法?有誰知道這是否已在任何Elite版本中修復?或者如果有解決方法?
需要一些緊急幫助。
感謝
我能夠在應用程序中做一些額外的編碼來解決這個問題。如果原來的bug在更高版本中得到修復,這將不再需要。
我的解決方案
我已經加入AJAX 2個事件,「排序」和「頁」在桌子上。我看到,在每一種'排序'表上都有正確的multisortmeta列表,但在分頁調用中,它正在用最初的數據寫完。
因此,我已經在每次排序調用中保存了bean中的multisortmeta列表,並且在分頁調用時我已經用bean中的內容寫出了表的multisortmeta列表。我的bean是一個會話bean,因此保存列表沒有問題。
完成此操作後,multisort正在處理分頁。下面是我的代碼
視圖/ XHTML代碼
<p:dataTable id="userDataTable"
value="#{userBean.userModel}" var="usr"
paginator="true" paginatorAlwaysVisible="false" sortMode="multiple"
rowsPerPageTemplate="20,40,60" rows="20"
sortBy="#{userBean.preSortOrder}" lazy="true"
resizableColumns="false" >
<p:ajax event="page" listener="#{userBean.onPage}" ></p:ajax>
<p:ajax event="sort" listener="#{userBean.onSort}" ></p:ajax>
豆代碼
public void onSort(SortEvent event) {
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
UIComponent tableComp = viewRoot.findComponent("userForm:userDataTable");
DataTable table = ((DataTable)tableComp);
preSortOrder = table.getMultiSortMeta();
}
public void onPage() {
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
UIComponent tableComp = viewRoot.findComponent("userForm:userDataTable");
DataTable table = ((DataTable)tableComp);
table.setMultiSortMeta(preSortOrder);
}
希望這將是對別人有用的。