-
1. Re: Row selection and highlighting
healeyb Jan 12, 2012 9:28 AM (in response to mpgong)Hi, something like this should do it. You could pass the row index as an a4j:param to a a4j:jsFunction, and then
figure out the corresponding Collection entry I guess (maybe other ways of doing this?).
private List<String> tableData = Arrays.asList("one", "two", "three", "four");
<h:dataTable id="testTable" value="#{mainView.tableData}" var="var">
<h:column>
<h:outputText value="#{var}"/>
</h:column>
</h:dataTable>
<script type="text/javascript">
jQuery(function($) {
$('#testTable tr').click(function() {
alert('hello ' + $(this).index());
$(this).css('background-color','red');
});
});
</script>
#testTable tr:hover {
background-color: #ff8080;
}
Regards,
Brendan.