0

ID employeeDataTable を持つデータテーブルがあり、その中に以下のような列としてコマンドボタンがあります

<p:commandButton value="Me" update=":#{p:component('primaryEmployeeDetails')}" id="ajax"
     actionListener="#{userPreferenceBean.saveEmployee}" styleClass="ui-priority-primary">
     <f:param name="employeeName" value="#{employee.name}" />
</p:commandButton>

Jquery内のコマンドボタンを操作できるように、すべてのコマンドボタンを制御したいと考えています。これが私がやっていることです -

 $(document).ready(function() {
        $(".ui-priority-primary").click(function() {
        //Getting all rows to iterate through them
        var row = $(document.getElementById("myForm:employeeDataTable")).find("tbody:first").children("tr");
        row.each(function() {
            alert('inside row');
            $(this).find('td').each(function(){
                   alert('inside each cell')
            });
        });
     });

両方のアラートは正常に機能しています。しかし、2 番目のループですべてのコマンド ボタンの参照を取得する方法を教えてもらえますか? ありがとう。

4

1 に答える 1

0

最後に、以下のコードで機能を実現できます。私を導いてくれた@BalusCに特に感謝します。ここで答えを共有します。

$(document).ready(function() {
        $(".ui-priority-primary").click(function() {
            var buttons = $(".ui-priority-primary");
            var rows = $(document.getElementById("myForm:employeeDataTable")).find("tbody:first").children("tr");
                rows.each(function() {
                      alert('Inside Row Loop');
                });

                $(buttons).each(function(){
                      $(this).doUserOperation();
                });
        });
});
于 2013-09-17T17:51:03.910 に答える