HTML代碼
<table id="msgtable" class="fixed_headers table table-bordered " >
<thead>
<tr>
<th ><s:text name="smsc.sigtrace.seq" /></th>
<th><s:text name="smsc.sigtrace.module" /></th>
<th><s:text name="smsc.sigtrace.event" /></th>
<th><s:text name="smsc.sigtrace.eventdesc" /></th>
<th><s:text name="smsc.sigtrace.direction" /></th>
<th><s:text name="smsc.sigtrace.time" /></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
CSS代碼
<style>
.tr_hover{background-color:#47C240}
.selected{background-color: #51b2f6}
</style>
js代碼
$(document).on('messageReceived',function(e, data){
try{
$.each(data, function(i, rowData){
$('#msgtable').messageTable('appendData', [rowData]);
});
}catch(ex){
JSTOOL.debug(ex);
};
$('tr:gt(0)').mouseover(function(){
$(this).addClass('tr_hover');
}).mouseout(function(){
$(this).removeClass('tr_hover');
});
$(function () {
$('tbody>tr').click(function () {
$(this).addClass('selected')
.siblings().removeClass('selected')
.end();
});
});
});