JSF框架下的的dataTable表,点击当前行,当前行的背景颜色变为黄色?
代码为:
<div id= "div_subQQPane ">
<h:dataTable id= "nameMenuTable " value= "#{menuMgrBean.nameMenu} " var= "das "
width= "100% " cellspacing= "0 " cellpadding= "0 "
rowClasses= "evenColumn,oddColumn " border= "0 " style= "text-align:center; ">
<h:column>
<h:graphicImage width= "17 " height= "17 "
url= '#{(das.status == 0)? "images/alive.gif ": "images/dead.gif "} '/>
</h:column>
<h:column>
<h:commandLink value= "#{das.name} "
action= "#{menuMgrBean.contentAction} " immediate= "true "
title= "IP:#{das.IP} "> sad
<f:actionListener type= "cn.com.pbi.netmgr.web.morning.VisitPathBean " />
<f:param name= "deviceId " value= "#{das.id} " />
<f:param name= "cmdText " value= "DeviceInfo " />
</h:commandLink>
</h:column>
<h:column>
<h:commandLink value= "[#{ 'Delete '}] "
actionListener= "#{menuMgrBean.deleteDeviceListener} "
title= "Delete "
rendered= "#{das.status != 0} ">
<f:param name= "deviceId " value= "#{das.id} " />
</h:commandLink>
</h:column>
</h:dataTable>
</div>
------解决方案--------------------使用样式表css来定义
------解决方案--------------------up
------解决方案--------------------css能定义鼠标事件吗?
------解决方案--------------------onclick事件!
------解决方案--------------------在 <h:column> 中使用 <h:panelGroup> 来包围所有的子元素,然后在 <h:panelGroup> 上加动态的
styleClass属性
------解决方案--------------------JS!
------解决方案--------------------function pageLoad(){
var tr_search_results = $( "table.search_results tr ");
if(tr_search_results.length > 0) {
tr_search_results.each(function(i, r) {
$(r).click(function(evt) {
var result_rows = $( "tr.selection_list_act_item ", $(this).parents( "table ").eq(0));
if(result_rows.length > 0) {
result_rows.each(function(i, r2) {
$(r2).removeClass( "selection_list_act_item ");
});
}
$(this).addClass( "selection_list_act_item ");
});
});
}
}