cognos中有列表和图形,但是表和图之间总是孤立的,刷新页面也都是全页面刷新,于是在想,是否有个方法能在点击cognos列表旁边的cognos图表能够实时的变动,类似flex中的绑定效果。
利用html的脚本功能
首先,建立图形报表,作为以后frmae里面的图形部分
然后建立列表,添加几个html
1.一个html用来定义调用图形报表,记得放在列表外,脚本如下
<script type="text/javascript">
function changeframe(par) { //alert(par); par=encodeURI(par);//如果是中文参数,需要进行编码转换 //alert(par); sname="http://localhost/cgi-bin/cognos.cgi?b_action=cognosViewer&ui.action=run&ui.object=%2fcontent%2ffolder%5b%40name%3d%27%e5%bf%ab%e6%8a%a5%27%5d%2freport%5b%40name%3d%27KPI%e6%8c%87%e6%a0%87--%e5%9b%be%e5%bd%a2%27%5d&ui.name=KPI%e6%8c%87%e6%a0%87--%e5%9b%be%e5%bd%a2&run.outputFormat=&ui.action=run&run.prompt=false&cv.toolbar=false&cv.header=false&p_para_bmzmc="+par; frameChart.location.href=sname; }
</script> 2.一个html控件在列表中,显示列表项,并将其作为参数调用图形报表
"<u><label onclick='changeframe("""+[Query1].[公司名称]+""");'style='width:100%;height:100%'>测试</label ></u>"
记得把html控件来源类型改成报表表达式
3.增加一个html,创建frame结构,设置的地方就是生成图形报表区域
<iframe frameborder="0" id="frameChart" src="" scrolling="no" height="400" width="100%"></iframe>
<div id="loading" style="display:block; padding:100px 0 100px 0;text-align:center;color:#999999;font-size:12px;"> 页面加载中 </div> <script type="text/javascript"> var a = document.getElementById("frameChart"); var b = document.getElementById("loading"); a.style.display = "none"; b.style.display = "block"; if (window.ActiveXObject) { a.onreadystatechange = function() { if (this.readyState=="complete") { b.innerHTML = ""; b.style.display = "none"; a.style.display = ""; } } }else{ a.style.display = "block"; //隐藏 b.style.display = "none"; } </script> 基本上是参照别人的例子改的,只是把html脚本合并在一起了
|
|