Jump to content
Changes to the Jaspersoft community edition download ×

The connected library in CVC does not work.


archivestas

Recommended Posts

JasperReports server 8.0.0
Jaspersoft studio 6.20.0

Connected the jQuery v3.5.0 libraries and https://github.com/vitmalina/w2ui/tree/w2ui-1.5.
Created cvc.
Completed the compilation build.js
It works in Jaspersoft studio.
I export it to the server, but it doesn't work here, the plug-in library w2ui is not added.

The problem is adding the wrapper:

wrap: {
        start: "(function(root){nnvar define = root.define;nn",
        end: "nn}(typeof __visualize__ != 'undefined' ? __visualize__ : (typeof __jrio__ != 'undefined' ? __jrio__ : window)));"
    },      
If add this wrapper, it will not work in Jaspersoft studio and JasperReports Server.

If the wrapper is not added, it will only work in Jaspersoft studio.


  build.js:

({
    baseUrl: '',
    optimize: 'none',
    paths: {
            'jquery': 'jquery350min',
            'w2': 'w2ui-1.5.min',
            'custom': 'custom'
    },
    optimizeCss: 'standard.keepLines',
    keepAmdefine: true,
    wrap: {
        start: "(function(root){nnvar define = root.define;nn",
        end: "nn}(typeof __visualize__ != 'undefined' ? __visualize__ : (typeof __jrio__ != 'undefined' ? __jrio__ : window)));"
    },        
    name: "custom",
    out: "custommin.js"
})
my module:

define('custom', ['jquery', 'w2'], function($) {
                
        var counter = 1;        
        return function (instanceData) {    
        
            const series = instanceData.series[0];
            const records = addRecid(series);
            const columns = createColumns(series); 
            creatediv(instanceData, instanceData.id, 'main');
         
            function creatediv(instanceData, elemntId, name) {
                const newDiv = document.createElement("div");
                newDiv.id = name;
                newDiv.style = "width: 100%; height: 100%;";        
                window.document.getElementById(elemntId).appendChild(newDiv);
            }
             
            function createColumns(records) {
                  const columns = [];
                  for (var key in records[0]) {
                    if (records[0].hasOwnProperty(key)) {
                        
                          columns.push({ field: key, text: key, size: '33%', sortable: true, searchable: true });
                    }
                  }
                  return columns;
            }
              
            function addRecid(records) {
                   const newrecords = [];
                   for (var i = 0; i < records.length; i++) {
                    const record = records;
                    record.recid = counter++;
                    newrecords.push(record);
                  }
                  return newrecords;
            }
            
            $(function () {
                $('#main').w2grid({
                name: 'grid',
                        show: {
                            toolbar: true,
                            toolbarDelete: true
                        },
                        columns: columns,
                        records: records
                });
            });    
        }
});

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Hello,

Please try to use latest studio 8.x.x version and give try adding wrapper and check if it works in Jaspersoft studio.
Without wrapper added - What error you see in jasperserver.log file on JasperReports Server.
Looking at error log might help us to narrow down this.

Link to comment
Share on other sites

There are no server-side errors in the log file. Errors only when trying to use the functions of the connected libraries. I am applying 2 projects with different libraries. Errors manifest for w2ui. There are no errors for Grid, but it does not work properly.

Tested on versions of jaspersoft studio 6.20.0, 6.20.1, 6.20.3.

Tested on jasperreports server versions 8.0.0, 8.1.1.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...