Skip to content

Commit

Permalink
Skip Tabulator row selection when clicking on expand button (#3474)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Apr 29, 2022
1 parent de182a9 commit c9ff0dd
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions panel/models/tabulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1011,9 +1011,15 @@ export class DataTabulatorView extends PanelHTMLBoxView {
}

// Update model

rowClicked(e: any, row: any) {
if (this._selection_updating || this._initializing || (typeof this.model.select_mode) === 'string' || this.model.select_mode === false || this.model.configuration.dataTree)
if (
this._selection_updating ||
this._initializing ||
(typeof this.model.select_mode) === 'string' ||
this.model.select_mode === false || // selection disabled
this.model.configuration.dataTree || // dataTree does not support selection
e.srcElement?.innerText === "►" // expand button
)
return
let indices: number[] = []
const selected = this.model.source.selected
Expand Down Expand Up @@ -1059,7 +1065,13 @@ export class DataTabulatorView extends PanelHTMLBoxView {
}

rowSelectionChanged(data: any, _: any): void {
if (this._selection_updating || this._initializing || (typeof this.model.select_mode) === 'boolean' || (typeof this.model.select_mode) === 'number' || this.model.configuration.dataTree)
if (
this._selection_updating ||
this._initializing ||
(typeof this.model.select_mode) === 'boolean' ||
(typeof this.model.select_mode) === 'number' ||
this.model.configuration.dataTree
)
return
const indices: number[] = data.map((row: any) => row._index)
const filtered = this._filter_selected(indices)
Expand Down

0 comments on commit c9ff0dd

Please sign in to comment.