Change default value for data chooser adhoc report (domains)

Table of Contents 

Issue Description:

I want to put domains as a default value when i create an adhoc report and choose its data source, but presently a topic has this default value.


Resolution:

modify <js-install>/scripts/adhoc.start.js

In the initialize section of adhocStart(), there is a switch statement that specifies the default  behavior:

    /**
     * This is for the initialization of ad Hoc's start page
     */
    initialize : function(){
        dialogs.popup.show($("sourceDialog"), true);
        //get the topic path
        var options;
        var UNSPECIFIED_TOPIC ="unspecifiedTopic";
        if(!defaultTopic){
            this.DefaultTopicsPath = defaultTopicDir + UNSPECIFIED_TOPIC;
        }else{
            this.DefaultTopicsPath = defaultTopicDir + defaultTopic;
        }
 
        if(!isNotNullORUndefined(this.TopicsTreeContainerId)){
            return;
        }
 
        switch (window.launchType) {
            case this.DOMAIN_LAUNCH_TYPE:
                this.hideRealmTree(this.DOMAIN);
                this.getDomains();
            break;
            case this.OLAP_CONNECTION_LAUNCH_TYPE:
                this.hideRealmTree(this.OLAP_CONNECTION);
                this.getOlapConnections();
            break;
            default:
                // Fall back to Adhoc Topic
                this.getTopics();
        }
        this.initializeHandlers();
    },

Modify the switch statement to look like this:

        switch (window.launchType) {
            case this.DOMAIN_LAUNCH_TYPE:
                this.hideRealmTree(this.DOMAIN);
                this.getDomains();
            break;
            case this.OLAP_CONNECTION_LAUNCH_TYPE:
                this.hideRealmTree(this.OLAP_CONNECTION);
                this.getOlapConnections();
            break;
            default:
                // Fall back to Adhoc Topic
                // this.getTopics();
                this.hideRealmTree(this.DOMAIN);
                this.getDomains();
        }

Restart JasperReports Server


Ref. Case #00032221

Feedback
randomness