mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
* Change in files * Renamin files and folders * cleaning up a single piece of lint * Removing boat picture from docs * add superset word mark * Update rename note in docs * Fixing images * Pinning datatables * Fixing issues with mapbox-gl * Forgot to rename one file * Linting * v0.13.0 * adding pyyaml to dev-reqs
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import { fixDataTableBodyHeight } from '../javascripts/modules/utils';
|
|
const $ = require('jquery');
|
|
|
|
require('datatables.net-bs');
|
|
require('./pivot_table.css');
|
|
require('datatables-bootstrap3-plugin/media/css/datatables-bootstrap3.css');
|
|
|
|
module.exports = function (slice) {
|
|
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);
|
|
});
|
|
}
|
|
return {
|
|
render: refresh,
|
|
resize: refresh,
|
|
};
|
|
};
|