Hi,try to link your checkboxes or whatever you use with an event handler ... e.g. 'checkchange'. If you have a dynamic TOC you should give each TOC entry an id, in this case best id is the service id. Save alle services/layers in an array. If checkchange fires you can do something like this:
//Listener on an ExtJS Component
listeners: {
'checkchange': function(node, checked){
if(checked){
node.getUI().addClass('complete');
var size = node.parentNode.childNodes.length;
for(var i=0;i<size;i++) {
if(node.parentNode.childNodes.id != node.id) {
node.parentNode.childNodes.ui.checkbox.checked = false;
Ext.getCmp('mappanel).setLayerVisibility(node.parentNode.childNodes.id, false);
}else {
Ext.getCmp('mappanel).setLayerVisibility(node.id, true);
}
}
}else{
node.getUI().removeClass('complete');
}
}
}
//function definition in ExtJS
setLayerVisibility: function(id, visible) {
var size = this.oLayer.length; //in this array all layers/services are saved
for(var i=0;i<size;i++) {
if(this.oLayer.id == id) {
if(visible)
this.oLayer.show();
else
this.oLayer.hide();
}
}
}
With this example you activate only one layer/service at a time ... i just c&p parts from an ExtJS sample of mine and didn't alter it to a common example ... you might have to change some parts.Summary ... give TOC an evhandler and show/hide layers linked via id to the TOC.Hope that helps a little bit ... greets Tol