Wijmo SpreadJS with RequireJS

682 views Asked by At

I am having an issue with getting spreadJS to work as an AMD module. Although there is documentation here that attempts to address how to use wijmo with AMD it revolves around using their own CDN:

http://wijmo.com/using-wijmo-with-requirejs/

I have reviewed the spread documentation and found that spreadJS is broken down into a number of modules, listed here:

http://helpcentral.componentone.com/NetHelp/SpreadHClientUG/webframe.html#modules.html

I have tried configuring requireJS:

requirejs.config({
    paths: {
      jquery: 'common/js/vendor/jquery-1.9.1',
      jquery_ui: 'common/js/vendor/jquery-ui',
      spread: 'vendor/spread/plugin/spreadAllMax.1.20133.6'
    },
    shim: {
      spread: {
        deps: ['jquery', 'jquery_ui']
      }
    }
});

Unfortunately, while the module loads properly it does not work. I believe this might have to do with trying to create an AMD module with a script that already contains multiple modules, but I am not completely comfortable with requireJS.

Has anyone successfully used spreadJS with require?

2

There are 2 answers

1
Ashish On

SpreadJS supports module libraries in the latest release. So, you can use part of SpreadJS according to you requirement. Eg: if you only use some basic functions of SpreadJS , then you can only add core and calc js references instead of adding the complete JS.

Here is a document about using SpreadJS modules: http://helpcentral.componentone.com/NetHelp/SpreadHClientUG/webframe.html#modules.html

0
xaep On

I tried, it works. Beside config code, you need add this code:

require(["jquery", "jquery-ui", "spreadjs"], function () {$("#ss").wijspread();});