in components/js/slickGrid.ts [351:400]
private initGrid(): void {
// https://github.com/mleibman/SlickGrid/wiki/Grid-Options
let options = {
enableCellNavigation: true,
enableColumnReorder: this.enableColumnReorder,
renderRowWithRange: true,
showHeader: this.showHeader,
rowHeight: this.rowHeight,
defaultColumnWidth: 120,
editable: this.enableEditing,
autoEdit: this.enableEditing,
enableAddRow: false, // TODO change when we support enableAddRow
enableAsyncPostRender: this.enableAsyncPostRender,
editorFactory: {
getEditor: (column: ISlickColumn<any>) => this.getColumnEditor(column)
},
formatterFactory: {
getFormatter: this.getFormatter
}
};
this._grid = new Slick.Grid(
this._el.nativeElement.getElementsByClassName('grid')[0],
this._gridData,
this._gridColumns,
options);
if (this.selectionModel) {
if (typeof this.selectionModel === 'object') {
this._grid.setSelectionModel(this.selectionModel);
} else if (typeof this.selectionModel === 'string' && Slick[this.selectionModel] && typeof Slick[this.selectionModel] === 'function') {
this._grid.setSelectionModel(new Slick[this.selectionModel]());
} else {
console.error(`Tried to register selection model ${this.selectionModel},
but none was found to be attached to Slick Grid or it was not a function.
Please extend the Slick namespace with the selection model as a function before registering`);
}
}
for (let plugin of this.plugins) {
this.registerPlugin(plugin);
}
this._columnNameToIndex = {};
for (let i = 0; i < this._gridColumns.length; i++) {
this._columnNameToIndex[this._gridColumns[i].name] = i;
}
this.onResize();
}