:: Forum >> Version 2 >>

Fix: missing click event in checkbox template

This problem (missing onItemClicked, onCellClicked events) happens because the checkbox template uses refresh method to update the display and it destroys the current html element. The solution is to make a custom refresh() method which selectively updates styles and content text, but does not recreate the html elements -

new AW.Templates.Checkbox// create classes
AW.Templates.Checkbox.prototype.refresh = function(){
    
try {
        var 
text this.getControlProperty("text");
        var 
image this.getControlProperty("image") || "none";
        
this.getContent("box/text").element().innerHTML text;
        
this.getContent("box/image").element().className "aw-item-image aw-image-" image;
        
this.refreshClasses();
    }
    
catch(err){
    }
}
 
The similar fix is required for custom tree item checkbox template -

var MyTreeCheckbox AW.Tree.Item.subclass();

MyTreeCheckbox.create = function(){
    
AW.Templates.Checkbox.create.call(this);

    var 
obj this.prototype;

    
obj.refresh = function(){
        
try {
            var 
text this.getControlProperty("text");
            var 
image this.getControlProperty("image") || "none";
            
this.getContent("box/text").element().innerHTML text;
            
this.getContent("box/image").element().className "aw-item-image aw-image-" image;
            
this.refreshClasses();
        }
        
catch(err){
        }
    }
}
 
Alex (ActiveWidgets)
Tuesday, September 11, 2007



This topic is archived.

Back to support forum

Forum search