[Users] Radio Button in Sub-nodes (Treeview)...

Andreas Hocevar ahocevar at opengeo.org
Fri Oct 2 21:58:58 CEST 2009


Hey-

one note on Format.JSON::write: I only used this in the tree.js example
to provide a means of changing the tree configuration via the user
interface. This is nothing that you would do in a real-life application.

Lazy loading of JSON configurations from a remote server is a different
story, and Ext helps us a lot with it. nodeTypes are for loading
different nodes, and for customized UIs, you can provide a list of
uiProviders with the tree's default loader.

Regards,
Andreas.

Paul james wrote:
> Update...
> The problem was the Format.JSON().write function... It was not
> rendering the baseAttrs method...
> I put that inside
>       root: {
>             nodeType: "async",         
>             children:
> ...
>  
> And worked fine...
>  
> Thanks Andreas for the great help!
>  
> Paul
>
> On Thu, Oct 1, 2009 at 2:26 PM, Paul james <pauljame at gmail.com
> <mailto:pauljame at gmail.com>> wrote:
>
>     Thanks again Andreas...
>     I tried that code (just added cb variable)...
>     But the radio button never shows up... No javascript error
>     reported as well... I think it is not entering in render function ...
>     Any idea?
>      
>      loader: {
>                 param: "LAYERS",
>                 baseAttrs: {
>                     uiProvider: Ext.extend(Ext.tree.TreeNodeUI, {
>                         render: function(bulkRender) {
>                             var cb = this.checkbox; //added
>
>                            
>     Ext.tree.TreeNodeUI.prototype.render.apply(this, arguments);
>                             Ext.DomHelper.insertAfter(cb, '<input
>     type="radio" class="gx-tree-radio" name="radio"></input>' );
>                         },
>                         onClick: function(e) {
>                             if(e.getTarget('.gx-tree-radio', 1)) {
>                                 // do whatever you want to do when
>     radio button was clicked
>                             }
>                             else {
>                                
>     Ext.tree.TreeNodeUI.prototype.onClick.apply(this,arguments);
>                             }
>                         }
>                     })
>                 }
>             }
>      
>     Paul
>      
>     On Thu, Oct 1, 2009 at 5:35 AM, Andreas Hocevar
>     <ahocevar at opengeo.org <mailto:ahocevar at opengeo.org>> wrote:
>
>         Hey Paul,
>
>         in the simplest case, it would look something like this:
>
>         nodeType: "gx_layer",
>         layer: "Tasmania (Group Layer)",
>         isLeaf: false,
>         loader: {
>            param: "LAYERS",
>            baseAttrs: {
>                uiProvider: Ext.extend(Ext.tree.TreeNodeUI, {
>                    render: function(bulkRender) {
>                      
>          Ext.tree.TreeNodeUI.prototype.render.apply(this, arguments);
>                        Ext.DomHelper.insertAfter(cb,
>                          '<input type="radio" class="gx-tree-radio"
>         name="radio"></input>'
>                        );
>                    },
>                    onClick: function(e) {
>                        if(e.getTarget('.gx-tree-radio', 1)) {
>                            // do whatever you want to do when radio
>         button was
>         clicked
>                        } else {
>                            
>         Ext.tree.TreeNodeUI.prototype.onClick.apply(this,
>         arguments);
>                        }
>                    }
>                })
>            }
>         }
>
>         Regards,
>         Andreas.
>
>         Paul james wrote:
>         > I was talking about that with Andreas :
>         >
>         > > What I tried to do :
>         > > 1-) Add radio button to Group Layer ...
>         > > nodeType: "gx_layer",
>         > >         layer: "Tasmania (Group Layer)",
>         > >         isLeaf: false,
>         > >         loader: {
>         > >             param: "LAYERS",
>         > >             baseAttrs: {radioGroup: "foo2"}
>         > >         }
>         > >
>         > > That doesnt work... Radio never shows up...
>         > Andreas Hocevar:
>         >
>         > > Yeah, because sub-nodes use a plain TreeNodeUI. If you
>         want to use these
>         > > additional radio buttons, you can try to configure the
>         LayerParamNodes
>         > > with a LayerNodeUI. But I doubt that this will work out of
>         the box.
>         > > Otherwise, it requires a custom UI. Patches for a generic
>         > > additional-radio-button-UI-mixin are welcome.
>         >
>         > Now, I悲 like help, and how can I do that custom UI... Any
>         help will
>         > be great...
>         >
>         >
>         > Paul
>         >
>         ------------------------------------------------------------------------
>         >
>         > _______________________________________________
>         > Users mailing list
>         > Users at geoext.org <mailto:Users at geoext.org>
>         > http://www.geoext.org/cgi-bin/mailman/listinfo/users
>         >
>
>
>         --
>         Andreas Hocevar
>         OpenGeo - http://opengeo.org/
>         Expert service straight from the developers.
>
>
>


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list