From 2735e41098d4c04f9b9e13dac0d11586e66befc6 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 19 Sep 2013 00:33:11 -0700 Subject: [PATCH] updated history/missing layout to use collection sync events. --- UI/History/HistoryLayout.js | 15 ++++++++------- UI/Missing/MissingLayout.js | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/UI/History/HistoryLayout.js b/UI/History/HistoryLayout.js index 146361aef..160ef9227 100644 --- a/UI/History/HistoryLayout.js +++ b/UI/History/HistoryLayout.js @@ -77,6 +77,13 @@ define( } ], + + initialize: function () { + this.collection = new HistoryCollection(); + this.listenTo(this.collection, 'sync', this._showTable); + }, + + _showTable: function (collection) { this.history.show(new Backgrid.Grid({ @@ -92,14 +99,8 @@ define( }, onShow: function () { - var self = this; - this.history.show(new LoadingView()); - - var collection = new HistoryCollection(); - collection.fetch().done(function () { - self._showTable(collection); - }); + this.collection.fetch(); } }); diff --git a/UI/Missing/MissingLayout.js b/UI/Missing/MissingLayout.js index 805998380..3b4ae5195 100644 --- a/UI/Missing/MissingLayout.js +++ b/UI/Missing/MissingLayout.js @@ -74,16 +74,17 @@ define( })); }, - onShow: function () { - var self = this; - - this.missing.show(new LoadingView()); + initialize: function () { this.missingCollection = new MissingCollection(); - this.missingCollection.fetch().done(function () { - self._showTable(); - }); + this.listenTo(this.missingCollection, 'sync', this._showTable); + }, + + + onShow: function () { + this.missing.show(new LoadingView()); + this.missingCollection.fetch(); this._showToolbar(); },