From 41654ef632ece469cbdc6a1441645a3bf2f0c21e Mon Sep 17 00:00:00 2001 From: SirrioN Date: Thu, 9 Jun 2016 09:05:28 +0300 Subject: [PATCH] Fix memory leak
  • elements (PageHandle) not remove with paginator. Redefine "remove" method of Paginator --- backgrid-paginator.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/backgrid-paginator.js b/backgrid-paginator.js index cb14e33..79a3287 100644 --- a/backgrid-paginator.js +++ b/backgrid-paginator.js @@ -442,7 +442,21 @@ this.el.appendChild(ul); return this; - } + }, + remove: function () { + if (this.handles) { + for (var i = 0, l = this.handles.length; i < l; i++) { + this.handles[i].remove(); + } + } + // COMPLETELY UNBIND THE VIEW + this.undelegateEvents(); + this.$el.removeData().unbind(); + this.stopListening(); + + // Remove view from DOM + Backbone.View.prototype.remove.call(this); + } });