mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
Simplifying the viz interface (#2005)
This commit is contained in:
committed by
GitHub
parent
1c338ba742
commit
e46ba2b4a4
@@ -8,34 +8,22 @@ import 'datatables.net';
|
||||
import dt from 'datatables.net-bs';
|
||||
dt(window, $);
|
||||
|
||||
module.exports = function (slice) {
|
||||
module.exports = function (slice, payload) {
|
||||
const container = slice.container;
|
||||
|
||||
function refresh() {
|
||||
$.getJSON(slice.jsonEndpoint(), function (json) {
|
||||
const fd = json.form_data;
|
||||
container.html(json.data);
|
||||
if (fd.groupby.length === 1) {
|
||||
const height = container.height();
|
||||
const table = container.find('table').DataTable({
|
||||
paging: false,
|
||||
searching: false,
|
||||
bInfo: false,
|
||||
scrollY: height + 'px',
|
||||
scrollCollapse: true,
|
||||
scrollX: true,
|
||||
});
|
||||
table.column('-1').order('desc').draw();
|
||||
fixDataTableBodyHeight(
|
||||
container.find('.dataTables_wrapper'), height);
|
||||
}
|
||||
slice.done(json);
|
||||
}).fail(function (xhr) {
|
||||
slice.error(xhr.responseText, xhr);
|
||||
const fd = payload.form_data;
|
||||
container.html(payload.data);
|
||||
if (fd.groupby.length === 1) {
|
||||
const height = container.height();
|
||||
const table = container.find('table').DataTable({
|
||||
paging: false,
|
||||
searching: false,
|
||||
bInfo: false,
|
||||
scrollY: height + 'px',
|
||||
scrollCollapse: true,
|
||||
scrollX: true,
|
||||
});
|
||||
table.column('-1').order('desc').draw();
|
||||
fixDataTableBodyHeight(
|
||||
container.find('.dataTables_wrapper'), height);
|
||||
}
|
||||
return {
|
||||
render: refresh,
|
||||
resize: refresh,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user