Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
reorderable = false
}
const options = {
enableCellNavigation: this.model.selectable !== false,
enableColumnReorder: reorderable,
forceFitColumns: this.model.fit_columns,
multiColumnSort: this.model.sortable,
editable: this.model.editable,
autoEdit: false,
rowHeight: this.model.row_height,
}
this.data = new TableDataProvider(this.model.source, this.model.view)
this.grid = new SlickGrid(this.el, this.data, columns, options)
this.grid.onSort.subscribe((_event: any, args: any) => {
if (!this.model.sortable)
return
columns = args.sortCols
this.data.sort(columns)
this.grid.invalidate()
this.updateSelection()
this.grid.render()
if (!this.model.header_row) {
this._hide_header()
}
this.model.update_sort_columns(columns)
})
if (this.model.selectable !== false) {
autoHeight: (this.model.height as any) == "auto",
multiColumnSort: this.model.sortable,
editable: this.model.editable,
autoEdit: false,
}
if (this.model.width != null)
this.el.style.width = `${this.model.width}px`
else
this.el.style.width = `${this.model.default_width}px`
if (this.model.height != null && (this.model.height as any) != "auto")
this.el.style.height = `${this.model.height}px`
this.data = new DataProvider(this.model.source, this.model.view)
this.grid = new SlickGrid(this.el, this.data, columns, options)
this.grid.onSort.subscribe((_event: any, args: any) => {
columns = args.sortCols
this.data.sort(columns)
this.grid.invalidate()
this.updateSelection()
this.grid.render()
})
if (this.model.selectable !== false) {
this.grid.setSelectionModel(new RowSelectionModel({selectActiveRow: checkboxSelector == null}))
if (checkboxSelector != null)
this.grid.registerPlugin(checkboxSelector)
this.grid.onSelectedRowsChanged.subscribe((_event: any, args: any) => {
if (this._in_selection_update) {
const columns = this.model.columns.map(column => column.toColumn())
columns[0].formatter = indentFormatter(columns[0].formatter, this.model.grouping.length)
delete columns[0].editor
this.data = new DataCubeProvider(
this.model.source,
this.model.view,
columns,
this.model.target,
)
this.data.setGrouping(this.model.grouping)
this.el.style.width = `${this.model.width}px`
this.grid = new SlickGrid(
this.el,
this.data,
columns,
options,
)
this.grid.onClick.subscribe(handleGridClick)
}
}