Skip to content

Commit

Permalink
Fixing table and pivot_table
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Feb 26, 2016
1 parent 8dcd5e0 commit d8409c1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 49 deletions.
2 changes: 1 addition & 1 deletion panoramix/assets/javascripts/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var sourceMap = {
markup: 'markup.js',
para: 'parallel_coordinates.js',
pie: 'nvd3_vis.js',
// pivot_table: undefined,
pivot_table: 'pivot_table.js',
sankey: 'sankey.js',
sunburst: 'sunburst.js',
table: 'table.js',
Expand Down
2 changes: 1 addition & 1 deletion panoramix/assets/visualizations/pivot_table.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
overflow: auto !important;
}

.widget.table td {
.widget.pivot_table td,th {

This comment has been minimized.

Copy link
@williaster

williaster Feb 26, 2016

Contributor

remember a new line for each selector, also the th selector is very general / the widget.pivot_table does not apply to it (a comma indicates the start of a brand new selection). consider:

.widget.pivot_table td,
.widget.pivot_table th {
/* attr: val; */
}

padding: 1px 5px;
font-size: small;
}
64 changes: 28 additions & 36 deletions panoramix/assets/visualizations/pivot_table.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
// // This is a hack because shimming for $ extensions is not working.
// $('body').append([
// '<script type="text/javascript" src="/static/refactor/vendor/dataTables/jquery.dataTables.min.js"></script>',
// '<script type="text/javascript" src="/static/refactor/vendor/dataTables/dataTables.bootstrap.js"></script>',
// ]);

// // require('datatables');
// // console.log(jQuery.fn.dataTable);
// // require('../vendor/dataTables/jquery.dataTables.min.js');
// // require('../vendor/dataTables/dataTables.bootstrap.js');
var $ = window.$ = require('jquery');
var jQuery = window.jQuery = $;

// // CSS
// require('./pivot_table.css');
// require('../vendor/dataTables/dataTables.bootstrap.css');
require('datatables');
require('./pivot_table.css');
require('../vendor/dataTables/dataTables.bootstrap.css');

// module.exports = function(slice) {
// var container = slice.container;
// var form_data = slice.data.form_data;
module.exports = function(slice) {
var container = slice.container;
var form_data = slice.data.form_data;

// function refresh() {
// $.getJSON(slice.jsonEndpoint(), function(json){
// container.html(json.data);
// if (form_data.groupby.length == 1){
// var table = container.find('table').DataTable({
// paging: false,
// searching: false,
// });
// table.column('-1').order( 'desc' ).draw();
// }
// slice.done(json);
// }).fail(function(xhr){
// slice.error(xhr.responseText);
// });
// }
// return {
// render: refresh,
// resize: refresh,
// };

// };
function refresh() {
$.getJSON(slice.jsonEndpoint(), function(json){
container.html(json.data);
if (form_data.groupby.length == 1){
var table = container.find('table').DataTable({
paging: false,
searching: false,
});
table.column('-1').order( 'desc' ).draw();
}
slice.done(json);
}).fail(function(xhr){
slice.error(xhr.responseText);
});
}
return {
render: refresh,
resize: refresh,
};
};
15 changes: 4 additions & 11 deletions panoramix/assets/visualizations/table.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
// This is a hack because shimming for $ extensions is not working.
$('head').append([
'<script type="text/javascript" src="/static/refactor/vendor/dataTables/jquery.dataTables.min.js"></script>',
'<script type="text/javascript" src="/static/refactor/vendor/dataTables/dataTables.bootstrap.js"></script>',
]);

// require('datatables');
// console.log(jQuery.fn.dataTable);
// require('../vendor/dataTables/jquery.dataTables.min.js');
// require('../vendor/dataTables/dataTables.bootstrap.js');
var $ = window.$ = require('jquery');
var jQuery = window.jQuery = $;

require('datatables');
// CSS
require('./table.css');
require('../vendor/dataTables/dataTables.bootstrap.css');
//require('../node_modules/datatables-bootstrap3-plugin/media/css/datatables-bootstrap3.css')

function tableVis(slice) {
var data = slice.data;
Expand Down

1 comment on commit d8409c1

@williaster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! lgtm.

Please sign in to comment.