Skip to content

Commit

Permalink
WV-136: Render was getting called many times because event handlers w…
Browse files Browse the repository at this point in the history
…ere not removed
  • Loading branch information
mike-mcgann committed Feb 25, 2013
1 parent 6d3774e commit 2424c59
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ SOTE.widget.Selector.handleLoadSuccess = function(data,status,xhr,args){
*
*/
SOTE.widget.Selector.prototype.render = function(){

this.container.innerHTML = "";

//this.container.innerHTML = "";
$("#"+this.id).empty();
$('#'+this.id).addClass('selector');

var catList = document.createElement("ul");
Expand Down Expand Up @@ -144,6 +144,7 @@ SOTE.widget.Selector.prototype.render = function(){
subFront.setAttribute("href","javascript:void(0);");
subFront.innerHTML = "<b>skip this step</b> to see all available layers >>";
this.container.appendChild(subFront);
$("#"+this.id).undelegate("#" + "subfront",'click');
$("#"+this.id).delegate("#" + "subfront",'click',{self:this,category:"All"},SOTE.widget.Selector.loadCategory);

// Mark the component as ready in the registry if called via init()
Expand Down Expand Up @@ -180,7 +181,9 @@ SOTE.widget.Selector.loadCategory = function(e){


var categories = new Object;
self.container.innerHTML = "";
//self.container.innerHTML = "";
$("#"+self.id).empty();

var titleContainer = document.createElement("div");
var title = document.createElement("h2");
title.innerHTML = "Choose Your Layers: " + cat;
Expand Down Expand Up @@ -263,6 +266,7 @@ SOTE.widget.Selector.loadCategory = function(e){
subBack.setAttribute("href","javascript:void(0);");
subBack.innerHTML = "<< <b>go back</b> and reselect my interest area";
self.container.appendChild(subBack);
$("#"+self.id).undelegate("#" + "subback",'click');
$("#"+self.id).delegate("#" + "subback",'click',{self:self},SOTE.widget.Selector.callRender);
}
self.adjustSelected();
Expand Down

0 comments on commit 2424c59

Please sign in to comment.