[英]detect when user check or uncheck row on client side in primefaces datatable
I use this row editing primefaces datatable and I added the multiple selection feature through this example 我使用此行编辑primefaces数据表,并通过此示例添加了多项选择功能
then I want to detect on client side when the user check or uncheck one row and the number of rows checked at each change 那么我想在客户端检测到用户选中或取消选中一行以及每次更改时选中的行数
I tried a many ways with firebug .... but no result 我用萤火虫尝试了很多方法....但是没有结果
here is one of my essays (just for testing): 这是我的一篇论文(仅用于测试):
$(function(){
$('.ui-chkbox-box.ui-widget.ui-corner-all.ui-state-default').mousemove(function(){
if(('.ui-chkbox-box.ui-widget.ui-corner-all.ui-state-default').hasClass('ui-state-active'))
alert('show');
});
do you have any idea 你有什么主意吗
If you just want know when a user clicked a checkbox that is located in a datatable, you can use this code to listen for the click and verify if it is checked or not: 如果只想知道用户何时单击了数据表中的复选框,则可以使用以下代码侦听该单击并验证是否选中了该单击:
jQuery(".ui-chkbox").click(function () {
if(jQuery(this).find("span").first().hasClass("ui-icon-check"))
alert("unchecked");
else
alert("checked");
}
Notice that the if clause is inverted, it happens because this function will be called before primefaces adds the class "ui-icon-check" to the div. 请注意,if子句是反向的,这是因为在primefaces向div添加“ ui-icon-check”类之前将调用此函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.