私は Primeface と JQuery の初心者です。データテーブルがあり、jquery でそのデータテーブルの特定のセルにアクセスしたいと考えています。以下は私がやろうとしていることです--
私のデータテーブルコード:
<p:dataTable id="employeeDataTable" var="employee" value="#{userPreferenceBean.employeeDataModel}"
paginator="true" rows="10" selection="#{userPreferenceBean.selectedEmployeeList}" rowIndexVar="rowIndex">
<f:facet name="header">
List of Employees
</f:facet>
<p:column selectionMode="multiple" style="width:2%" />
<p:column headerText="Primary Employee" style="width:2%">
<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>
</p:column>
<p:column headerText="Name" style="width:48%">
#{employee.name}
</p:column>
<p:column headerText="Department" style="width:48%">
#{employee.department}
</p:column>
<f:facet name="footer">
<p:commandButton id="submit" value="Save Preferences" icon="ui-icon-disk"
update=":#{p:component('selectedEmployeeDetails')}" />
</f:facet>
</p:dataTable>
JQuery から特定のセル (たとえば、n 番目の行と 2 番目の列) からコマンドボタンにアクセスしたいと思います。これが私が今やっていることです -
$(document).ready(function() {
$(".ui-priority-primary").click(function() {
alert('test')
var row = 'employeeDataTable:' + rowIndex + ':ajax';
$(row).each(function() {
alert('test again')
});
});
});
現在、「テスト」のアラートは機能していますが、「再テスト」のアラートは機能していません。これは、コマンド ボタンからクリック イベントを取得できることを意味します。しかし、データテーブルから特定のセルを取得できないようです。私がここでやっている間違いを理解するのを手伝ってもらえますか? ありがとう。
よろしく、 スディプタ・デブ