Permalink
Browse files

fix: pageindex hat nach reload falschen index

  • Loading branch information...
1 parent 95e32fa commit ce0e762a9844b0e02560e29a906385a33f402fdf Stephan committed Dec 3, 2012
Showing with 19 additions and 15 deletions.
  1. +17 −13 app/modules/localeEdit/views.js
  2. +2 −2 app/templates/localeedit/edit.html
@@ -136,7 +136,8 @@ Views.EditList = Backbone.View.extend({
},
events: {
- "click #SaveBtn" : "save"
+ "click #SaveBtn" : "save",
+ "click #ResetBtn" : "reload"
//,
//"change #taskSorting":"sorts"
},
@@ -177,28 +178,31 @@ Views.EditList = Backbone.View.extend({
cleanup: function() {
//this.collection.off(null, null, this);
},
+ reload: function(){
+ this.collection.reset();
+ this.collection.fetch();
+ this.goToPage(1);
+ },
+ goToPage: function(page) {
+ this.currentPage = page;
+ mediator.Publish('pageChanged', this.currentPage);
+ this.render();
+ },
prevPage: function(){
if(this.currentPage == 0 ) {
return;
};
- this.currentPage -= 1;
- mediator.Publish('pageChanged', this.currentPage);
- this.render();
+
+ this.goToPage(this.currentPage -= 1);
},
nextPage: function(){
- this.currentPage += 1;
- mediator.Publish('pageChanged', this.currentPage);
- this.render();
+ this.goToPage(this.currentPage += 1);
},
goToStart: function(){
- this.currentPage = 1;
- mediator.Publish('pageChanged', this.currentPage);
- this.render();
+ this.goToPage(1);
},
goToEnd: function(){
- this.currentPage = (this.collection.length / this.pageSize) +1;
- mediator.Publish('pageChanged', this.currentPage);
- this.render();
+ this.goToPage((this.collection.length / this.pageSize) +1);
},
initialize: function() {
this.collection.on("reset", this.render, this);
@@ -12,11 +12,11 @@
<% } %>
</div>
<div class="pull-right">
- <button id="SaveBtn" type="foo" class="btn btn-primary save">
+ <button id="SaveBtn" class="btn btn-primary save">
<i class=" icon-ok icon-white"></i>
<span>Save</span>
</button>
- <button type="foo" class="btn btn-danger delete">
+ <button id="ResetBtn" class="btn btn-danger delete">
<i class="icon-ban-circle icon-white"></i>
<span>Reload</span>
</button>

0 comments on commit ce0e762

Please sign in to comment.