Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Tabulator ajax call on empty data #2161

Merged
merged 1 commit into from
Apr 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions panel/models/tabulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export class DataTabulatorView extends PanelHTMLBoxView {
}

getConfiguration(): any {
const pagination = this.model.pagination == 'remote' ? 'local': (this.model.pagination || false)
let configuration = {
...this.model.configuration,
index: "_index",
Expand All @@ -166,21 +167,22 @@ export class DataTabulatorView extends PanelHTMLBoxView {
cellEdited: (cell: any) => this.cellEdited(cell),
columns: this.getColumns(),
layout: this.getLayout(),
ajaxURL: "http://panel.pyviz.org",
ajaxSorting: true,
pagination: this.model.pagination == 'remote' ? 'local': this.model.pagination,
pagination: pagination,
paginationSize: this.model.page_size,
paginationInitialPage: 1,
}
let data = this.model.source;
if (data === null || Object.keys(data.data).length===0)
return configuration;
else {
data = transform_cds_to_records(data, true)
return {
...configuration,
"data": data,
}
if (pagination)
configuration['ajaxURL'] = "http://panel.pyviz.org"
const cds: any = this.model.source;
let data: any[]
if (cds === null || (cds.columns().length === 0))
data = transform_cds_to_records(cds, true)
else
data = []
return {
...configuration,
"data": data,
}
}

Expand Down