Skip to content

Commit

Permalink
Inline-ify the clashing function (#1279)
Browse files Browse the repository at this point in the history
**Story card:** https://app.clubhouse.io/simpledotorg/story/1128/broken-tablesort

On investigation, it appears that the `initializeTables` function that was being used to initialize tablesort is now clashing with an `initializeTables` method in reports.js.

This PR simply inlines the initialization of tablesort to avoid naming clashes, but it's a good reminder that we need to start writing properly scoped JS 😄
  • Loading branch information
harimohanraj89 committed Sep 2, 2020
1 parent 042fa29 commit ff93255
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/assets/javascripts/common/analytics.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
window.addEventListener("DOMContentLoaded", initializeTables);

function initializeTables() {
window.addEventListener("DOMContentLoaded", function() {
if($('#analytics-table').length) {
new Tablesort(document.getElementById('analytics-table'), { descending: true })
}
}
});

0 comments on commit ff93255

Please sign in to comment.