我尝试使用(注入)JQuery插件到JSF dataTable的每一行, 我有下一个简单的例子:
1)JQuery插件:
(function ( $ ) {
$.fn.testPlagin = function(param) {
//do something with param
//append internal div etc.
};
}( jQuery ));
2)dataTable(JSF):
<h:dataTable value="#{order.orderList}" var="order">
//there will be implemented my testPlagin for each row
// I was trying add testPlagin bellow, but it is completely not working (and I want to ask ... how it must be?)
//My attempt:
<div id="#order"> // in this line I try to add unique Id use hash code of bean
<script>
$(document ).ready(function() {
var divObj = $('#'+ #{order}) // try to get div above
divObj.testPlagin(#{order.number});
});
</script>
</div>
</h:dataTable>