BIRT 报表高亮选中行
在HTML中,要高亮选中一行非常简单,在<tr> 标签上加上onmouseover 事件和onmouseout , 然后使用this.style.backgroundColor=xxx 来表示 , 比如如下代码
<table border="1">
<tr onmouseover="this.style.backgroundColor=’red’;" onmouseout="this.style.background=’white’">
<td>hello world hello world</td>
<td>hello world hello world</td>
<td>hello world hello world</td>
<td>hello world hello world</td>
</tr>
</table>
BIRT 报表中当然也是可以嵌入HTML 和javascript 的, 通过在 "Text" 元素中选择 "HTML" 和 Formatting 格式.
birt-exchange 上有一个例子演示了如何在html 中鼠标移动的时候高亮选中一行,里面同时也演示了在对应的图表上怎么样鼠标移动时对应的表格里面的行也被高亮选中.通过在 chart 上的y轴添加一个onmouseover 事件.
另外一个需要注意的就是里面的<tr> 元素的id 是通过 bookmark 属性确定的. 这个例子中,bookmark 的值就是row["Country"] . 其余也不用多说.仔细看例子就知道了. 里面用来一点javascript . 可以学学怎么样取得table 的id 的.
参考资料