From 6dddc2ad84ca485fededd3e16a801cb10a3256a9 Mon Sep 17 00:00:00 2001 From: George Stephanis Date: Thu, 13 Aug 2015 13:01:42 -0400 Subject: [PATCH] Moving initialize up to the top. --- .../admin/settings-views-html-settings-tax.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/assets/js/admin/settings-views-html-settings-tax.js b/assets/js/admin/settings-views-html-settings-tax.js index 0e1ca8c8f5e..1be67a96720 100644 --- a/assets/js/admin/settings-views-html-settings-tax.js +++ b/assets/js/admin/settings-views-html-settings-tax.js @@ -66,6 +66,19 @@ rowTemplate : rowTemplate, per_page : data.limit, page : data.page, + initialize : function() { + this.qty_pages = Math.ceil( _.toArray( this.model.get( 'rates' ) ).length / this.per_page ); + this.page = this.sanitizePage( data.page ); + + this.listenTo( this.model, 'change:rates', this.setUnloadConfirmation ); + // this.listenTo( this.model, 'saved:rates', this.clearUnloadConfirmation ); + $tbody.on( 'change', { view : this }, this.updateModelOnChange ); + $tbody.on( 'sortupdate', { view : this }, this.updateModelOnSort ); + $search_field.on( 'keyup search', { view : this }, this.onSearchField ); + $pagination.on( 'click', 'a', { view : this }, this.onPageChange ); + $pagination.on( 'change', 'input', { view : this }, this.onPageChange ); + $(window).on( 'beforeunload', { view : this }, this.unloadConfirmation ); + }, render : function() { var rates = this.model.getFilteredRates(), qty_rates = _.size( rates ), @@ -138,19 +151,6 @@ window.history.replaceState( {}, '', url ); }, - initialize : function() { - this.qty_pages = Math.ceil( _.toArray( this.model.get( 'rates' ) ).length / this.per_page ); - this.page = this.sanitizePage( data.page ); - - this.listenTo( this.model, 'change:rates', this.setUnloadConfirmation ); - // this.listenTo( this.model, 'saved:rates', this.clearUnloadConfirmation ); - $tbody.on( 'change', { view : this }, this.updateModelOnChange ); - $tbody.on( 'sortupdate', { view : this }, this.updateModelOnSort ); - $search_field.on( 'keyup search', { view : this }, this.onSearchField ); - $pagination.on( 'click', 'a', { view : this }, this.onPageChange ); - $pagination.on( 'change', 'input', { view : this }, this.onPageChange ); - $(window).on( 'beforeunload', { view : this }, this.unloadConfirmation ); - }, onSearchField : function( event ){ event.data.view.updateUrl(); event.data.view.render();