我可以在 GoldenLayout 中将 Slickgrid 与普通网格一起使用。
但是,我正在尝试实现 Dataview,但我遇到了 onRowCountChanged.subscribe 事件的问题:
var StockGridComponent = function (container, state) {
this._dataView = new Slick.Data.DataView();
this._container = container;
this._state = state;
this._grid = null;
this._columns = [...];
this._data = data;
container.on('open', this._createGrid, this);
};
StockGridComponent.prototype._createGrid = function () {
this._grid = new Slick.Grid(
this._container.getElement(),
this._dataView,
this._columns,
this._options
);
this._grid.setSelectionModel(new Slick.CellSelectionModel());
this._dataView.onRowCountChanged.subscribe(function (e, args) {
console.log(this); <-- return DataView
this._grid.updateRowCount(); <-- error: "Uncaught TypeError: Cannot read property 'updateRowCount' of undefined"
this._grid.render();
}
);
我认为我的问题是我不知道如何引用对象的 _grid 对象(我不精通 Javascript)。
任何使用 Goldenlayout 和 SlickGrid Dataview 的人都可以分享他们如何创建他们的 SlickGrid 组件?
谢谢你。