Well, I think I found a solution at least.  Triggering events didn't work
and nothing I tried with the node.attributes.radio methods listed in the IE
Developer Tools debugger worked either.

Dan Ramage, who put together the RCOOS site, tried something for me as well
as that site has the same issue.  While what he tried didn't quite work, it
did give me an idea.  Decided to add an arbitrary property when creating the
overlay layers called "active".  I set it to true for the layer I wanted to
be active and the others I set to false.  Then in the GeoExt
RadioButtonPlugin.js code made this modification to the OnRenderNode
function:

    onRenderNode: function(node) {
        var a = node.attributes;
        if(a.radioGroup && !a.radio) {
            if(!node.layer.active) {
              a.radio = Ext.DomHelper.insertBefore(node.ui.anchor,
                ['<input type="radio" class="gx-tree-radio" name="',
                a.radioGroup, '_radio"></input>'].join(""));
            }
            else {
              a.radio = Ext.DomHelper.insertBefore(node.ui.anchor,
                ['<input type="radio" class="gx-tree-radio" name="',
                a.radioGroup, '_radio" checked="true"></input>'].join(""));
            }
        }
    },

(could change this in the TreeNodeRadioButton.js as it has the same
function, but using RadioButtonPlugin at present)

So, before the layer node is rendered, there's now a check for the active
property:

if(!node.layer.active)

If active is not true, the radio button is configured as before.  But if it
is true, then add checked="true" to the Ext.DomHelper line to make the radio
button the one that's clicked/checked when the page is loaded.

Like I said, the solution works for both IE8 and Firefox 6.0.1 which is all
I was able to test at present.  Will still have to check Chrome and IE9.

Thanks for anyone who looked into this but were scratching their heads as
well.  It's been puzzling me for days.

Dave M

On Wed, Aug 31, 2011 at 12:08 PM, David Miller <teknocrea...@gmail.com>wrote:

> Good day folks!  The app I'm working on has a tree with selectable optional
> overlays via check boxes plus an active layer radio button.  When the app
> loads, I would like to specify one of the layers as active.  I found in an
> earlier thread that if I put in this snippet before the end of the
> Ext.onReady():
>
> var node= tree.root.findChild('layer',wwalayer,true);
> Ext.get(node.attributes.radio).set({
>      'checked': true
> });
>
> then the wwalayer radio button is "checked" when the page loads in Firefox
> so the user knows it is active.  But, for some reason, this does not happen
> in IE8, though the layer is active.  I know because a pop window appears on
> mouseover of the vector layer "Hazards"...won't do this if layer is not
> active.  I'd like to have the same behavior in both browsers.  I've tried
> examining the page via Developer Tools in IE8, but things don't seem to
> match up when I use Firebug in Firefox, i.e. there's node.attributes.radio
> in both but there's no 'checked' property displayed in the Developer Tools
> window when debugging in IE8.  It's there in Firebug, though.  I've tried
> looking through the list of properties but couldn't seem to find a property
> I could use for both.
>
> My test page:
>
> http://www.mdl.nws.noaa.gov/wxmap/wxmapHourlyDay_test.php
>
> I have thought of maybe triggering the radiochange event and seeing if that
> would work.  Just didn't get there yet and was perhaps hoping someone else
> may have run into this issue.
>
> Thanks for any help and I'll report if I solved this via triggering the
> event.
>
> Dave M
>
>
_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to