-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8dcd5e0
commit d8409c1
Showing
4 changed files
with
34 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 comment
on commit d8409c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! lgtm.
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; */
}