问题
I'm trying to call a javascript function whenever a row of a datatable is selected .I can't use ajax because I don't need to send a request and wait for a response from the server to fade in/out a menuBar. One last remark ,the datatable is in single selection mode . Any help will be appreciated ..
回答1:
PrimeFaces Extensions comes to the rescue here.
Use
<pe:javascript event="rowSelect" execute="alert('Datatable rowSelect event called')"/>
If you need the row key for the selected row, use:
<pe:javascript event="rowSelect" execute="console.log(ext.params[0].value)"/>
See also
- http://www.primefaces.org/showcase-ext/sections/clientBehaviours/javascriptBehaviourAnother.jsf
来源:https://stackoverflow.com/questions/29362860/primefaces-datatable-on-row-select-javascript-callback