Cognos 11 - 搜索和选择提示 - 重置选择、输入关键字和结果

如何解决Cognos 11 - 搜索和选择提示 - 重置选择、输入关键字和结果

我需要在单击按钮时重置提示,在我的情况下是“RESET”按钮,如下面的屏幕截图所示。我可以在 customControl 中使用 clearValues() JavaScript API 清除 Month-Year 和 Order-Method VALUE 提示,但使用 Search and Select 提示 clearValues() 函数仅清除 SnS 提示中结果窗格中的选定值,但我们需要清除结果窗格中的输入关键字和结果,我可以通过设置输入标签的 .value(用于关键字)并重置包含结果选项的 Div 的 html 来清除它们,但是当页面重新加载之前选择的关键字,结果选择重新出现,例如在您重置然后将年份从 2011 年切换到 2012 年或反之亦然后,之前搜索的输入关键字和结果会重新出现在 SnS 提示中。

[在此处输入图片说明][1]

enter image description here

报告 XML

<report xmlns="http://developer.cognos.com/schemas/report/15.5/"           expressionLocale="en-us" useStyleVersion="11.6">
                
                <drillBehavior/>
                <layouts>
                    <layout>
                        <reportPages>
                            <page name="Page1">
                                <style>
                                    <defaultStyles>
                                        <defaultStyle refStyle="pg"/>
                                    </defaultStyles>
                                </style>
                                <pageBody>
                                    <style>
                                        <defaultStyles>
                                            <defaultStyle refStyle="pb"/>
                                        </defaultStyles>
                                    </style>
                                    <contents><table><style><CSS value="border-collapse:collapse;width:100%"/><defaultStyles><defaultStyle refStyle="tb"/><defaultStyle refStyle="GuidedLayoutMargin"/></defaultStyles></style><tableRows><tableRow><tableCells><tableCell><contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="border-collapse:collapse"/></style><tableRows><tableRow><tableCells><tableCell><contents/><style><CSS value="text-align:left;vertical-align:top"/></style></tableCell><tableCell><contents/><style><CSS value="text-align:left;vertical-align:top"/><defaultStyles><defaultStyle refStyle="GuidedLayoutLeftPadding"/></defaultStyles></style></tableCell></tableCells></tableRow></tableRows></table></contents><style><CSS value="text-align:left;vertical-align:top;width:50%"/><defaultStyles><defaultStyle refStyle="GuidedLayoutRightPadding"/></defaultStyles></style></tableCell><tableCell><contents/><style><CSS value="text-align:left;vertical-align:top;width:50%"/><defaultStyles><defaultStyle refStyle="GuidedLayoutLeftPadding"/></defaultStyles></style></tableCell></tableCells></tableRow></tableRows></table><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="border-collapse:collapse"/></style><tableRows><tableRow><tableCells><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents><textItem><dataSource><staticValue>Select Year</staticValue></dataSource></textItem></contents><style><CSS value="font-weight:bold"/></style></tableCell><tableCell><contents><textItem><dataSource><staticValue>Select Month-Year</staticValue></dataSource></textItem></contents><style><CSS value="font-weight:bold"/></style></tableCell><tableCell><contents><textItem><dataSource><staticValue>Search and Select Product Type</staticValue></dataSource></textItem></contents><style><CSS value="font-weight:bold"/></style></tableCell><tableCell><contents><textItem><dataSource><staticValue>Select Order Method</staticValue></dataSource></textItem></contents><style><CSS value="font-weight:bold"/></style></tableCell><tableCell><contents/></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents><selectValue name="PeriodPmt" parameter="p_period" refQuery="Query2" selectValueUI="radioGroup" autoSubmit="true"><style><CSS value="height:60px"/></style><defaultSelections><defaultSimpleSelection>2011</defaultSimpleSelection></defaultSelections><selectOptions><selectOption useValue="2011"><displayValue>2011</displayValue></selectOption><selectOption useValue="2012"><displayValue>2012</displayValue></selectOption></selectOptions><useItem refDataItem="Year"><displayItem refDataItem="Year"/></useItem></selectValue></contents><style><CSS value="vertical-align:top;padding-left:30px"/></style></tableCell><tableCell><contents><selectValue cascadeOn="p_period" name="MonthPmt" parameter="p_months" refQuery="Query2"><useItem refDataItem="Month key"><displayItem refDataItem="Month (caption)"/></useItem></selectValue></contents><style><CSS value="vertical-align:top;padding-left:30px"/></style></tableCell><tableCell><contents><selectWithSearch hideAdornments="true" name="SNS" parameter="p_product" refQuery="Query1"><useItem refDataItem="Product"><displayItem refDataItem="Product"/></useItem></selectWithSearch></contents><style><CSS value="vertical-align:top;padding-left:30px"/></style></tableCell><tableCell><contents><selectValue name="OrderMethodPmt" parameter="p_orderMethod" refQuery="Query3"><useItem refDataItem="Order method type"><displayItem refDataItem="Order method type"/></useItem></selectValue></contents><style><CSS value="vertical-align:top;padding-left:30px"/></style></tableCell><tableCell><contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="border-collapse:collapse;width:100%;border:1pt solid black"/></style><tableRows><tableRow><tableCells><tableCell><contents><promptButton type="finish">
                                                                                                                                <contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="margin:0px;border-collapse:collapse;width:46px;height:22px"/></style><tableRows><tableRow><tableCells><tableCell><contents><textItem><dataSource><staticValue>✓</staticValue></dataSource><style><CSS value="font-family:&apos;Davita Icons&apos;;font-size:14px;color:#1566A7;width:15px;height:17px"/></style></textItem></contents><style><CSS value="text-align:left;vertical-align:middle;padding-right:4px"/></style></tableCell><tableCell><contents><textItem><dataSource><staticValue>Apply</staticValue></dataSource></textItem></contents><style><CSS value="text-align:left;height:22px;width:46px;vertical-align:middle;font-family:Lato;font-size:16px"/></style></tableCell></tableCells></tableRow></tableRows></table></contents>
                                                                                                                                <style>
                                                                                                                                    <CSS value="padding:0px;height:22px;width:46px;color:#1566A7;border-top-style:none;border-bottom-style:none;border-left-style:none;border-right-style:none;background-color:white"/></style>
                                                                                                                            </promptButton></contents><style><CSS value="padding-right:10px;border:1pt solid black"/></style></tableCell><tableCell><contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="margin:0px;border-collapse:collapse;width:46px;height:22px"/></style><tableRows><tableRow><tableCells><tableCell><contents><textItem><dataSource><staticValue>x</staticValue></dataSource><style><CSS value="font-family:&apos;Davita Icons&apos;;font-size:14px;color:#1566A7;width:15px;height:17px"/></style></textItem></contents><style><CSS value="text-align:left;vertical-align:middle;padding-right:4px"/></style></tableCell><tableCell><contents><customControl description="CustomReset" name="CustomFinishCancelClear" path="/javascript/poc/clearPrompts.js"><configuration>{
    &quot;noSelectPrompts&quot;: [
        &quot;OrderMethodPmt&quot;,&quot;MonthPmt&quot;
    ],&quot;SnSPrompts&quot;: [
        &quot;SNS&quot;
    ],&quot;preSelectPrompts&quot;: [
        {
            &quot;promptName&quot;: &quot;PeriodPmt&quot;,&quot;promptDefault&quot;: [
                {
                    &quot;use&quot;: &quot;2011&quot;,&quot;display&quot;: &quot;2011&quot;
                }
            ]
        }
    ]
}</configuration></customControl></contents><style><CSS value="text-align:left;height:22px;width:46px;vertical-align:middle;font-family:Lato;font-size:16px"/></style></tableCell></tableCells></tableRow></tableRows></table></contents><style><CSS value="padding-right:20px;padding-left:10px"/><defaultStyles><defaultStyle refStyle="GuidedLayoutLeftPadding"/></defaultStyles></style></tableCell></tableCells></tableRow></tableRows></table></contents><style><CSS value="vertical-align:top;padding-left:30px"/><defaultStyles><defaultStyle refStyle="GuidedLayoutTopPadding"/><defaultStyle refStyle="GuidedLayoutBottomPadding"/><defaultStyle refStyle="GuidedLayoutLeftPadding"/></defaultStyles></style></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents/><style><CSS value="vertical-align:top"/></style></tableCell><tableCell><contents/></tableCell><tableCell><contents><customControl description="defaultSnS" path="/javascript/defaultSnS-min.js" uiType="none"><configuration>{
    &quot;promptName&quot;: &quot;SNS&quot;,&quot;option&quot;: 3,&quot;height&quot;: 250
}</configuration></customControl></contents></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell><tableCell><contents/><style><CSS value="background-color:#99CCFF;height:10px"/></style></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents><promptButton type="reprompt" name="RepromptButton">
            <contents><textItem><dataSource><staticValue>Display Parameters Selected</staticValue></dataSource></textItem></contents>
            <style>
                <defaultStyles>
                    <defaultStyle refStyle="bp"/>
                </defaultStyles>
            </style>
        </promptButton></contents></tableCell><tableCell><contents><textItem><dataSource><staticValue>Product Type Selected</staticValue></dataSource></textItem></contents><style><CSS value="text-align:right"/></style></tableCell><tableCell><contents><textItem><dataSource><reportExpression>ParamDisplayValue(&apos;p_product&apos;)</reportExpression></dataSource></textItem></contents></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell></tableCells></tableRow><tableRow><tableCells><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell><tableCell><contents/></tableCell></tableCells></tableRow></tableRows></table></contents>
                                </pageBody>
                            </page>
                        </reportPages>
                    </layout>
                </layouts>
            <queries><query name="Query1">
            <source>
                <model/>
            </source>
            <selection><dataItem aggregate="none" rollupAggregate="none" name="Product"><expression>[Sales (query)].[Products].[Product type]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="3"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem></selection>
        </query><query name="Query2"><source><model/></source><selection><dataItem aggregate="none" rollupAggregate="none" name="Year"><expression>[Sales (query)].[Time].[Year]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="1"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem><dataItem aggregate="none" name="Month"><expression>[Sales (query)].[Time].[Month]</expression></dataItem><dataItem aggregate="none" rollupAggregate="none" name="Month key"><expression>[Sales (query)].[Time].[Month key]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="1"/><XMLAttribute output="no" name="RS_dataUsage" value="1"/></XMLAttributes></dataItem><dataItem aggregate="none" rollupAggregate="none" name="Month (caption)"><expression>[Sales (query)].[Time].[Month (caption)]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="3"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem><dataItem aggregate="none" rollupAggregate="none" name="Month1"><expression>[Sales (query)].[Time].[Month]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="3"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem><dataItem aggregate="none" rollupAggregate="none" name="Month number"><expression>[Sales (query)].[Time].[Month number]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="1"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem></selection><detailFilters><detailFilter><filterExpression>[Year] in (&apos;2011&apos;,&apos;2012&apos;)</filterExpression></detailFilter></detailFilters></query><query name="Query3">
            <source>
                <model/>
            </source>
            <selection><dataItem aggregate="none" rollupAggregate="none" name="Order method type"><expression>[Sales (query)].[Order method].[Order method type]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="3"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem></selection>
        </query></queries><XMLAttributes><XMLAttribute output="no" name="RS_CreateExtendedDataItems" value="true"/><XMLAttribute output="no" name="listSeparator" value=","/><XMLAttribute output="no" name="decimalSeparator" value="."/><XMLAttribute output="no" name="RS_modelModificationTime" value="2015-11-25T21:38:24.820Z"/></XMLAttributes><classStyles><classStyle name="GuidedLayoutLeftPadding"><CSS value="padding-left:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutTopPadding"><CSS value="padding-top:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutRightPadding"><CSS value="padding-right:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutBottomPadding"><CSS value="padding-bottom:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutMargin"><CSS value="margin-bottom:10px"/></classStyle></classStyles><modelPath>/content/folder[@name=&apos;Samples&apos;]/folder[@name=&apos;Extended&apos;]/folder[@name=&apos;Models&apos;]/package[@name=&apos;GO sales (query)&apos;]/model[@name=&apos;model&apos;]</modelPath><reportName>resetPrompts</reportName></report>

JAVASCRIPT 文件:文件名:clearPrompts.js

define(["jquery"],function() {
    "use strict";

    function validatePromptValue() {}
    validatePromptValue.prototype.initialize = function(oControlHost,fnDoneInitializing) {
        var o = oControlHost.configuration;
        if (!o) {
            throw new scriptableReportError("validatePromptValue","","Expected configuration.");
        }
        this.m_aPromptName = oControlHost.configuration.noSelectPrompts;
        this.m_aPromptSnS = oControlHost.configuration.SnSPrompts;
        this.m_aPromptDefault = oControlHost.configuration.preSelectPrompts;
        console.log(this.m_aPromptDefault);
        fnDoneInitializing();
    };
    validatePromptValue.prototype.draw = function(oControlHost) {
        var el = oControlHost.container;
        el.innerHTML = "<style>" + '.myButton {border:none; height:22px; width:44px; cursor:pointer;  color:#BB0000; font-size:16px; font-family: "Lato"; background-color:white; vertical-align: middle; text-align: left; }' + ".myButton:hover { color:#BB0000; }" + "</style>" + '<button class="myButton btnClear" type="button">Reset</button>';
        el.querySelector(".btnClear").onclick = this.f_clearButtonClick.bind(this,oControlHost);


    };
    validatePromptValue.prototype.f_clearButtonClick = function(oControlHost) {

        //No Defaults Prompts
        for (let i = 0; i < this.m_aPromptName.length; i++) {
            var oControl = oControlHost.page.getControlByName(this.m_aPromptName[i]);
            if (oControl) {
                if (oControl.name == this.m_aPromptName[i]) {
                    oControl.clearValues();
                }
            }
        }

        //Search and Select Prompts
        for (let i = 0; i < this.m_aPromptSnS.length; i++) {
            var oControl = oControlHost.page.getControlByName(this.m_aPromptSnS[i]);
            if (oControl.name == this.m_aPromptSnS[i]) {
                oControl.clearValues();
                var srchTxt = oControl.element.getElementsByClassName("clsSelectWithSearchSearchText")[0],resBox = oControl.element.getElementsByClassName('clsAdorment')[0],srchBttn = oControl.element.getElementsByClassName("clsSelectWithSearchSearchButton")[0];
                $(srchTxt).attr('value','%');
                $(srchTxt).removeAttr('value');
                //$(srchTxt).attr('autocomplete','off');
                // cognos.Report.Action.REPROMPT;
                // $(srchBttn).click();
                $(resBox).html('<div class="clsPromptSelectWithSearchMsg" style="line-height:40px; text-align:center;">No Results</div>');


            }
        }

        //Prompts with Default Selectionss
        for (let i = 0; i < this.m_aPromptDefault.length; i++) {
            var oControl = oControlHost.page.getControlByName(this.m_aPromptDefault[i].promptName);
            console.log(oControl);
            if (oControl) {
                if (this.m_aPromptDefault[i].promptName) {
                    //oControl.setValues(this.m_aPromptDefault[i].promptDefault);
                }
            }
        }


    };

    return validatePromptValue;
});

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)&gt; insert overwrite table dwd_trade_cart_add_inc &gt; select data.id, &gt; data.user_id, &gt; data.course_id, &gt; date_format(
错误1 hive (edu)&gt; insert into huanhuan values(1,&#39;haoge&#39;); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive&gt; show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 &lt;configuration&gt; &lt;property&gt; &lt;name&gt;yarn.nodemanager.res