:: Forum >>

Code Contribution: Disabling a grid

Here is how I'm disabling/enabling a grid...

obj.disable = function() {
this.setStyle("filter", "alpha(opacity=25)");
this.setStyle("opacity", ".25");
this.setStyle("-moz-opacity", ".25");

function _disable(oObject, sEventName) {
oObject["_" + sEventName] = oObject.getEvent(sEventName);
oObject.setEvent(sEventName, "");
}

_disable(this, "onkeydown" );
_disable(this, "onmousewheel");
_disable(this.getTemplate("row"), "onclick" );

var oTmp = this.getTemplate("top/item");
_disable(oTmp, "onmousedown" );
_disable(oTmp, "onmouseenter");
_disable(oTmp, "onmouseleave");
_disable(oTmp.getContent("div"), "onmousedown" );
_disable(this.getTemplate("layout").getContent("scrollbars"), "onscroll");
};

// ------------------------------------------------------------

obj.enable = function() {
this.setStyle("filter", "alpha(opacity=100)");
this.setStyle("opacity", "1");
this.setStyle("-moz-opacity", "1");

function _enable(oObject, sEventName) {
oObject.setEvent(sEventName, oObject["_" + sEventName]);
}

_enable(this, "onkeydown" );
_enable(this, "onmousewheel");
_enable(this.getTemplate("row"), "onclick" );

var oTmp = this.getTemplate("top/item");
_enable(oTmp, "onmousedown" );
_enable(oTmp, "onmouseenter");
_enable(oTmp, "onmouseleave");
_enable(oTmp.getContent("div"), "onmousedown" );
_enable(this.getTemplate("layout").getContent("scrollbars"), "onscroll");
};

Any improvements/suggestions welcome.
Steve N
Tuesday, June 7, 2005

This topic is archived.


Back to support forum

Forum search