简体   繁体   中英

Primefaces datatable row selection event

I'm trying to use Primefaces datatable with radiobutton-selection but the rowSelect event is not fired.

If I set selectionMode="single" in the datatable the event is fired, but the whole row is clickable.

<p:dataTable value="#{bean.items}" editable="true" var="item"  selection="#{bean.selectedItem}"  rowKey="#{item.id}">
    <p:ajax event="rowSelect" listener="#{bean.doSomething}" update=":form:msgs" />

    <p:column selectionMode="single" />
    ....

Is it possible to trigger the rowSelect-event when using radiobutton-selection?

Use the rowSelectRadio event

<p:ajax event="rowSelectRadio" listener="#{bean.doSomething}" update=":form:msgs" />

Check the PrimeFaces user guide. It lists all the ajax behaviour events for each component.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM