在交互分析中,報表經(jīng)常需要根據(jù)參數(shù)進行實時變化。也就是“參數(shù)聯(lián)動”效果,下面就通過一個例子說明潤乾報表是如何實現(xiàn)這種需求的。
創(chuàng)新互聯(lián)公司主營商水網(wǎng)站建設的網(wǎng)絡公司,主營網(wǎng)站建設方案,重慶APP開發(fā)公司,商水h5小程序定制開發(fā)搭建,商水網(wǎng)站營銷推廣歡迎商水等地區(qū)企業(yè)咨詢
頁面的左側(cè)為參數(shù)輸入?yún)^(qū)域,右側(cè)的數(shù)據(jù)報表需要根據(jù)參數(shù)實時查詢結(jié)果,效果如下圖:
連接默認的 demo 數(shù)據(jù)源,制作如下報表:
其中,報表參數(shù)為:
用于接收地區(qū)和城市參數(shù)。
報表數(shù)據(jù)集為:
定義參數(shù)輸入頁面,如下:
<html> <head> </head> <body> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="100%"> <tr> <td valign="top" align="center" width="10%"> <a >請選擇參數(shù):</a><br><br> <form> <select name="area" onChange="change(1,this.options\[this.selectedIndex\].value)"> <option value="華北" selected="selected">華北</option> <option value="東北">東北</option> <option value="華南">華南</option> <option value="華東">華東</option> </select> <br><br> <select name="city" onChange="change(2,this.options\[this.selectedIndex\].value)"> <option value="北京">北京</option> <option value="天津">天津</option> <option value="上海">上海</option> <option value="長春">長春</option> </select> </form> </td> <td width="90%"> <iframe width="100%" height="100%" frameborder="0" align="left" src="autoQuery.jsp?rpx=demo.rpx&area=華北&city=北京" scrolling="auto" id="report" name="report"> </td> </tr> <table> </body> </html>
<html> <head> </head> <body> <table border="1" cellpadding="0" cellspacing="0" width="100%" height="100%"> <tr> <td valign="top" align="center" width="10%"> <a >請選擇參數(shù):</a><br><br> <form> <select name="area" onChange="change(1,this.options\[this.selectedIndex\].value)"> <option value="華北" selected="selected">華北</option> <option value="東北">東北</option> <option value="華南">華南</option> <option value="華東">華東</option> </select> <br><br> <select name="city" onChange="change(2,this.options\[this.selectedIndex\].value)"> <option value="北京">北京</option> <option value="天津">天津</option> <option value="上海">上海</option> <option value="長春">長春</option> </select> </form> </td> <td width="90%"> <iframe width="100%" height="100%" frameborder="0" align="left" src="autoQuery.jsp?rpx=demo.rpx&area=華北&city=北京" scrolling="auto" id="report" name="report"> </td> </tr> <table> </body> </html>
其中,數(shù)據(jù)報表采用 iframe 嵌入,發(fā)布報表的 showReport.jsp 在潤乾報表的安裝包中。這里需要定義下拉框的 onChange 事件。加入以下 JS 代碼:
<script type="text/javascript"> function change(type,value){ var url = parent.document.getElementById("report").src; var arr = url.split("&"); var area = arr\[1\].split("=")\[1\]; var city = arr\[2\].split("=")\[1\]; if(type==1) area=value; if(type==2) city=value; document.getElementById("report").src="showReport.jsp?rpx=demo.rpx&area="+area+"&city="+city } </script>
<script type="text/javascript"> function change(type,value){ var url = parent.document.getElementById("report").src; var arr = url.split("&"); var area = arr\[1\].split("=")\[1\]; var city = arr\[2\].split("=")\[1\]; if(type==1) area=value; if(type==2) city=value; document.getElementById("report").src="showReport.jsp?rpx=demo.rpx&area="+area+"&city="+city } </script>
這樣,在選擇參數(shù)后會觸發(fā) onChange 事件,通過自動修改 iframe 的 src 屬性即可實現(xiàn)聯(lián)動查詢效果。
詳情鏈接: http://c.raqsoft.com.cn/article/1554689324200?r=gxy
分享題目:如何實現(xiàn)參數(shù)和報表間的聯(lián)動效果
網(wǎng)頁鏈接:http://chinadenli.net/article32/pddhsc.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供手機網(wǎng)站建設、網(wǎng)站建設、品牌網(wǎng)站建設、響應式網(wǎng)站、定制開發(fā)、定制網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)