我正在使用Primefaces DataTable在網格中顯示內容。我想使用拖放(shuffle)對這些行進行重新排序,我嘗試過jquery sortable,它只適用於那些,之後我需要刷新瀏覽器。 有什麼辦法可以實現嗎?如何在primefaces的Datatable中實現Drag and Drop(混洗行)?
非常感謝
我正在使用Primefaces DataTable在網格中顯示內容。我想使用拖放(shuffle)對這些行進行重新排序,我嘗試過jquery sortable,它只適用於那些,之後我需要刷新瀏覽器。 有什麼辦法可以實現嗎?如何在primefaces的Datatable中實現Drag and Drop(混洗行)?
非常感謝
目前還沒有辦法讓行的排序與服務器的副作用。您可以使用jQuery實現客戶端重新排序,但這不會存儲在服務器上。
$('.ui-datatable tbody').sortable();
有a discussion on the PrimeFaces forum。
還有an issue about drag/drop capability in PrimeFaces' issue tracker.請注意,該問題已關閉WontFix,所以我想你是運氣不好。
我試過這個,但是這也適用於一次。 –
@ManojKumar我知道,但這是唯一的解決方案。我建議你仔細閱讀我的答案,然後點擊我發佈的鏈接。 – siebz0r
此功能現在可以從PrimeFaces 5.0:
用法很簡單的通過只是使draggableRows選項,並且還提供了越來越有靈活性索引信息的ReorderEvent可選rowReorder AJAX行爲。
來源:http://blog.primefaces.org/?p=3026
您還可以看看這裏展示:http://www.primefaces.org/showcase/ui/data/datatable/reorder.xhtml
,據我所知是沒有分量這樣。你可以使用可排序的數據表http://www.primefaces.org/showcase-labs/ui/datatableSorting.jsf – erencan
你會在這裏找到解決方案:http://stackoverflow.com/questions/16940993/drag-and-drop- of-rows-primefaces-datatable-datagrid/21464068#21464068 – michalu