Primefaces datatable on row select javascript callback

杀马特。学长 韩版系。学妹 提交于 2019-12-24 04:44:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!