I've used the jQuery plugin jOrgChart with success in a SharePoint add-in by simply referencing the file and making the call, i.e.
<script type="text/javascript" src="jquery.jOrgChart.js"></script>
...
jQuery(document).ready(function() {
$("#org").jOrgChart();
});
Now I want to use the same plugin in a SPFx webpart. What have is:
import * as jQuery from "jquery";
import "jqueryui";
import "jorgchart";
// also tried with the same result:
// require("jorgchart");
...
let jOrgChart:any = require("./Scripts/jOrgChart.js");
...
jQuery("#org").jOrgChart({ chartElement: "#chart", dragAndDrop: false });
my json.config
file includes:
"externals": {
"jquery": {
"path": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.js",
"globalName": "jquery"
},
"jqueryui":{
"path": "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js",
"globalName": "jquery",
"globalDependencies": ["jquery"]
},
"jorgchart": {
"path": "./Scripts/jOrgChart.js",
"globalName": "jquery",
"globalDependencies": ["jqueryui"]
}
},
but I get the build TypeScript error: Property 'jOrgChart' does not exist on type 'JQuery'
. Is it something with the way the jOrgChart.js code is written?
Full code is here.
What am I missing?