Skip to content

Commit

Permalink
Fix issues when streaming or patching ReactiveData
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Nov 9, 2021
1 parent 002d3e1 commit 7250291
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
15 changes: 9 additions & 6 deletions panel/models/tabulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,14 +622,16 @@ export class DataTabulatorView extends PanelHTMLBoxView {
}

addData(): void {
const rows = this.tabulator.rowManager.getRows();
const rows = this.tabulator.rowManager.getRows()
const last_row = rows[rows.length-1]

let data = transform_cds_to_records(this.model.source, true);
this.tabulator.setData(data);
if (this.model.follow) {
if (!last_row)
return

let data = transform_cds_to_records(this.model.source, true)
this.tabulator.updateOrAddData(data)
if (this.model.follow)
this.tabulator.scrollToRow((last_row.data._index || 0), "top", false);
}
this.freezeRows()
this.updateSelection()
}
Expand All @@ -656,7 +658,8 @@ export class DataTabulatorView extends PanelHTMLBoxView {

setMaxPage(): void {
this.tabulator.setMaxPage(this.model.max_page)
this.tabulator.modules.page._setPageButtons()
if (this.tabulator.modules.page.pagesElement)
this.tabulator.modules.page._setPageButtons()
}

setPage(): void {
Expand Down
11 changes: 11 additions & 0 deletions panel/reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,17 @@ def _patch(self, patch):
cb = partial(m.source.patch, patch)
doc.add_next_tick_callback(cb)

def _update_manual(self, *events):
"""
Skip events triggered internally
"""
processed_events = []
for e in events:
if e.name == self._data_params[0] and e.type == 'triggered' and self._updating:
continue
processed_events.append(e)
super()._update_manual(*processed_events)

def stream(self, stream_value, rollover=None, reset_index=True):
"""
Streams (appends) the `stream_value` provided to the existing
Expand Down

0 comments on commit 7250291

Please sign in to comment.