I generated some active reports in cognos. Then I got across with this Dynamic reporting in Cognos using JQuery: http://www.ibm.com/developerworks/library/ba-pp-reporting-advanced-report-design-page647/
我在cognos中生成了一些活跃的报告。然后我使用JQuery在Cognos中获得了这个动态报告:http://www.ibm.com/developerworks/library/ba-pp-reporting-advanced-report-design-page647/
I generated some interactive reports with JQuery. But now I want to genearate an active report using JQuery. I tried but it didn't work. So is there a way to use JQuery in mht files? (as active reports are stored in that format).
我用JQuery生成了一些交互式报告。但现在我想用JQuery创建一个活跃的报告。我试过但它没用。那么有没有办法在mht文件中使用JQuery? (因为活动报告以该格式存储)。
This is the code I took in HTML item in report studio:
这是我在report studio中的HTML项目中的代码:
<script type="text/javascript">
var j = jQuery.noConflict();
j(document).ready(function()
{
alert("hello");
j('.ShowHideMap').hide();
j('.ShowHideClicker').click(function()
{
j(this).next().toggle();
});
});
</script>
<div class="ShowHideClicker">Click here to show/hide the Map Report</div>
<div class="ShowHideMap">
Map comes here
</div>
I am using Firefox for opening the active reports. When I open the report, and click on "Click here to show/hide the Map Report", its not hiding.
我正在使用Firefox打开活动报告。当我打开报告,并点击“点击此处显示/隐藏地图报告”时,它不会隐藏。
I took a notepad and typed the following code and saved it as "test.mht"
我拿了一个记事本并键入以下代码并将其保存为“test.mht”
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery-ui.min.js"></script>
<script type="text/javascript">
var j = jQuery.noConflict();
j(document).ready(function()
{
j('.ShowHideMap').hide();
j('.ShowHideClicker').click(function()
{
j(this).next().toggle();
});
});
</script>
</head>
<body>
<div class="ShowHideClicker">Click here to show/hide the Map Report</div>
<div class="ShowHideMap">
Map
</div>
</body>
</html>
It worked. When I click on "Click here to show/hide the Map Report", the word Map is showing/hiding. But when I took the same code in HTML item in active reports, reports are not showing/hiding.
有效。当我点击“点击此处显示/隐藏地图报告”时,单词Map显示/隐藏。但是当我在活动报告中的HTML项目中使用相同的代码时,报告不会显示/隐藏。
1 个解决方案
#1
This may help
这可能有所帮助
https://bobsbiblog.wordpress.com/2014/08/25/creating-javascript-functions-in-active-reports/
The key to this technique is the tag which is one of the few to include an onLoad event. This event fires as soon as the image is displayed.
这种技术的关键是标签,它是少数包含onLoad事件的标签之一。显示图像后,此事件将立即触发。
Add an HTML item anywhere on the report, just make sure it’s somewhere that will always be rendered (on the page, but not inside any decks). Give the HTML item the following text:
在报表的任何位置添加HTML项目,只需确保它始终呈现在某处(在页面上,但不在任何卡片内)。为HTML项目提供以下文本:
<img src="hal/imagesirot/progress.gif" width="1" height="1" onload="
while( ! alert) {}
/* Define the function */
if (!document.testFunction ) {
testFunction = function() {
alert('We are running the test function');
}
}
/* Run any startup actions */
testFunction();
"/>
#1
This may help
这可能有所帮助
https://bobsbiblog.wordpress.com/2014/08/25/creating-javascript-functions-in-active-reports/
The key to this technique is the tag which is one of the few to include an onLoad event. This event fires as soon as the image is displayed.
这种技术的关键是标签,它是少数包含onLoad事件的标签之一。显示图像后,此事件将立即触发。
Add an HTML item anywhere on the report, just make sure it’s somewhere that will always be rendered (on the page, but not inside any decks). Give the HTML item the following text:
在报表的任何位置添加HTML项目,只需确保它始终呈现在某处(在页面上,但不在任何卡片内)。为HTML项目提供以下文本:
<img src="hal/imagesirot/progress.gif" width="1" height="1" onload="
while( ! alert) {}
/* Define the function */
if (!document.testFunction ) {
testFunction = function() {
alert('We are running the test function');
}
}
/* Run any startup actions */
testFunction();
"/>