mirror of
https://github.com/apache/superset.git
synced 2024-09-19 12:09:42 -04:00
a8fd23dfa4
`.jsx` linting is now in-scope for the `npm run lint` command, and I linted the base files and some of the viz, there's still quite a bit of work there, but that's a first pass on it.
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,
|
|
};
|
|
};
|