What i want to do is; when user clicks to row, it will select the row.When user double clicks to row, it will start cell editing. At Primefaces showcase(http://www.primefaces.org/showcase/ui/d ... nstant.jsf) it says "Instant row selection, dblclick selection and unselection is implemented using ajax behaviors." but i couldnt find where they implemented dblclick selection. Is there a way to start cell editing event with double click event?
问问题
32603 次
3 回答
20
<p:ajax event="rowDblselect">
于 2013-10-02T13:43:18.803 回答
18
利用
<p:ajax event="rowDblselect" />
在你<p:dataTable />
这样:
<p:dataTable
id="yourTableId"
value="#{yourBean.items}"
selectionMode="single"
selection="#{yourBean.selectedItem}"
var="item"
rowKey="#{item.id}">
<p:ajax
event="rowDblselect"
listener="#{yourBean.onRowDoubleClick}"
update="@form:theComponentYouWantToUpdate"
global="false" />
<!-- your columns here -->
</p:dataTable>
在您的 bean/控制器中使用:
import org.primefaces.event.SelectEvent;
public void onRowDoubleClick(final SelectEvent event) {
YourObject obj = (YourObject) event.getObject();
// rest of your logic
}
于 2013-10-02T13:30:32.310 回答
0
试着dblClickSelect="true"
放在你的桌子上。
从文档中:
默认情况下,单击事件启用基于行的选择,启用 dblClickSelect 以便在行上双击进行选择。
于 2013-05-07T14:41:24.953 回答