How to use the slickgrid/plugins/slick.rowselectionmodel.RowSelectionModel function in slickgrid

To help you get started, we’ve selected a few slickgrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bokeh / bokeh / bokehjs / src / lib / models / widgets / tables / data_table.ts View on Github external
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) {
      this.grid.setSelectionModel(new RowSelectionModel({selectActiveRow: checkboxSelector == null}))
      if (checkboxSelector != null)
        this.grid.registerPlugin(checkboxSelector)

      const pluginOptions = {
        dataItemColumnValueExtractor(val: Item, col: TableColumn) {
          // As defined in this file, Item can contain any type values
          let value: any = val[col.field]
          if (isString(value)) {
            value = value.replace(/\n/g, "\\n")
          }
          return value
        },
        includeHeaderWhenCopying: false,
      }

      this.grid.registerPlugin(new CellExternalCopyManager(pluginOptions))
github bokeh / bokeh / bokehjs / src / coffee / models / widgets / tables / data_table.ts View on Github external
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) {
          return
        }

        const selected = hittest.create_empty_hit_test_result()
        selected.indices = args.rows.map((i: number) => this.data.index[i])
        this.model.source.selected = selected
      })

      this.updateSelection()
    }
  }