我正在尝试使用以下脚本fin-Hypergrid
向组件添加简单,但是我不断收到错误:GoldenLayout
Uncaught TypeError: this.div.appendChild is not a function @Hypergrid.js:854
Uncaught TypeError: Cannot set property 'range' of null @Hypergrid.js:2132
,
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<div id="fin-grid"></div>
<script src="https://openfin.github.io/fin-hypergrid/build/fin-hypergrid.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="https://golden-layout.com/files/latest/js/goldenlayout.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://golden-layout.com/files/latest/css/goldenlayout-base.css" /></script>
<script>
var config = {
content: [{
type: 'stack',
content: [
{
type: 'component',
componentName: 'example',
componentState: {}
}
]
}]
};
var myLayout = new GoldenLayout(config);
var hyperGridComponent = function (container, state) {
this._hyperGridcontainer = container;
container.on('open', this._createHyperGrid.bind(this));
};
hyperGridComponent.prototype._createHyperGrid = function () {
var data = [
{ symbol: 'APPL', name: 'Apple Inc.', prevclose: 93.13 },
{ symbol: 'MSFT', name: 'Microsoft Corporation', prevclose: 51.91 },
{ symbol: 'TSLA', name: 'Tesla Motors Inc.', prevclose: 196.40 },
{ symbol: 'IBM', name: 'International Business Machines Corp', prevclose: 155.35 }
];
var grid = new fin.Hypergrid(this._hyperGridcontainer.getElement(), { data: data });
grid.addProperties({
showRowNumbers: false,
showFilterRow: false
});
};
myLayout.registerComponent('example', hyperGridComponent);
myLayout.init();
</script>
</body>
</html>
关于如何解决这些错误的任何想法?