簡體   English   中英

檢測用戶何時檢查或取消檢查primefaces數據表中客戶端的行

[英]detect when user check or uncheck row on client side in primefaces datatable

我使用此行編輯primefaces數據表,並通過此示例添加了多項選擇功能

那么我想在客戶端檢測到用戶選中或取消選中一行以及每次更改時選中的行數

我用螢火蟲嘗試了很多方法....但是沒有結果

這是我的一篇論文(僅用於測試):

$(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');
                });

你有什么主意嗎

如果只想知道用戶何時單擊了數據表中的復選框,則可以使用以下代碼偵聽該單擊並驗證是否選中了該單擊:

jQuery(".ui-chkbox").click(function () {
    if(jQuery(this).find("span").first().hasClass("ui-icon-check"))
        alert("unchecked");            
    else
        alert("checked");
}

請注意,if子句是反向的,這是因為在primefaces向div添加“ ui-icon-check”類之前將調用此函數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM