0
datatableのrowIndexVarをjqueryに渡す必要があります。変数をJqueryに渡す
DATATABLE:
<p:dataTable id="articlesInformation" var="article" value="#{articleBean.articleDataModel}"
selection="#{articleBean.selArticles}" rowIndexVar="rowIndex">
のinputText:
<p:column id="articleDescription" headerText="Article Description">
<p:inputText id="inputTxt" name="inputTxt" value="#{article.description}" />
</p:column>
この入力テキストのIDは次のようになる。 'articlesInformation:' + rowIndexに+ ':inputTxt'。
のjQuery:
$(document).ready(function(){
$('input[id$="inputTxt"]').change(function() {
$('input[id$="inputTxt"]').css("background-color","yellow");
});
});
これはかなりうまく動作します。すべての入力テキストの背景色が変更されます。私はちょうど変更された入力テキストの背景色を変更する必要があります。 rowIndexの値が必要です。 jqueryでどのようにアクセスできますか?あなたが行IDを取得するrowIndexVarを必要といけない
おかげで、 Shikha
.ATTR( 'rowIndexVar')内keypressed/chanedイベントなど。 上の行のインデックスを取得することができますか? – miki
@miki未定義です。私はそこに見えません。それはdatatableの属性として宣言されています。スコープの問題私は推測します.. –