Wednesday, 14 March 2012

Changing an icon in a treepanel extjs 3

It took me a while to find a solution - probably a slow head day but here's how;
In this case a node represents a web mapping service. If the WMS is alive it should return a list of layers which are used to create a series of child nodes. So if no children change the icon to something relevant.

the css file;
.failedwms-icon {
background: url('resources/deadwms.gif') no-repeat;
height: 16px;
width: 16px;

in your js code;
'load': function(node){
// if a node receives a response and no layer child nodes are created we want to change the icon
if (node.childNodes) {
if (node.childNodes)
if (node.childNodes.length == 0)
node.attributes.iconCls = 'failedwms-icon';
node.getUI().iconNode.className = node.attributes.iconCls;

Wednesday, 7 March 2012

compiling OpenLayers

Grab it from their github:

Drop closure-compiler.jar & compiler.jar into openlayers\tools
Go to \build and ... -c closure full OpenLayers.js for regular compressed OpenLayers (700kb odd) full OpenLayers-uncompressed.js for phat Openlayers (2.5Mb odd)