diff --git a/cmsranking/static/DataStore.js b/cmsranking/static/DataStore.js index 1b6ac259c..16e1c0403 100644 --- a/cmsranking/static/DataStore.js +++ b/cmsranking/static/DataStore.js @@ -722,7 +722,7 @@ var DataStore = new function () { }); self.create_event_source(); - self.init_selections(); + self.init_callback(); }; self.update_rank = function (u_id, user) { @@ -786,8 +786,8 @@ var DataStore = new function () { - they also start an AJAX request and process its data - when BOTH requests finish init_scores() is called - it does again an AJAX request and processes its data - - at the end it calls init_ranks() which calls init_selections() which, - in turn, calls init_callback() + - at the end it calls init_ranks() which calls init_callback() + - Subsequently, when TeamStore is initialized, we call init_selections(). */ self.init = function (callback) { @@ -1157,8 +1157,6 @@ var DataStore = new function () { } } }); - - self.init_callback(); }; self.set_selected = function (u_id, flag, color_idx) { diff --git a/cmsranking/static/Ranking.js b/cmsranking/static/Ranking.js index 00a0c4a74..74d54ba1b 100644 --- a/cmsranking/static/Ranking.js +++ b/cmsranking/static/Ranking.js @@ -40,7 +40,9 @@ $(document).ready(function() { HistoryStore.init(); UserDetail.init(); TimeView.init(); - TeamSearch.init(); + TeamSearch.init(function() { + DataStore.init_selections(); + }); Overview.init(); Scoreboard.init(); }); diff --git a/cmsranking/static/TeamSearch.js b/cmsranking/static/TeamSearch.js index 3161b919e..fa079834d 100644 --- a/cmsranking/static/TeamSearch.js +++ b/cmsranking/static/TeamSearch.js @@ -18,7 +18,7 @@ var TeamSearch = new function () { var self = this; - self.init = function () { + self.init = function (callback) { $("#TeamSearch_input").focus(function () { self.show(); }); @@ -98,6 +98,7 @@ var TeamSearch = new function () { self.update(); DataStore.select_events.add(self.select_handler); + callback(); }; self.generate = function () {