1 Reply Latest reply on Dec 16, 2009 7:26 AM by PeakDigital

    Set Tree items' editable property independent of Tree editable property?

    PeakDigital Level 1

      Is there any way to make only selected nodes in a Tree editable?  For example, branch nodes .editable=true, non-branch nodes .editable=false?

       

      If so, can you point me to some resources that show how to work with them?

       

      Thanks.

      Paul

        • 1. Re: Set Tree items' editable property independent of Tree editable property?
          PeakDigital Level 1

          Here's what I ended up with, using the preventDefault() method of the event. In my system the standard is that branch nodes are editable, leaf nodes are not.

           

          This function is called as listener on the Tree's ITEM_EDIT_BEGINNING event:

           

          public function setItemEditableStatus(event:ListEvent):void
                      {        
                      if(event.itemRenderer!==null)
                          {//not sure why sometimes itemRenderer is null, but it throws a 1009 if it is...
                          if(event.itemRenderer.data.@isBranch==false)
                              {
                              event.preventDefault();
                              trace("setItemEditableStatus called, is NOT a branch node = PREVENT edit ");
                              }
                          else
                              {
                              trace("setItemEditableStatus called, is a branch node = allow edit ");
                              }            
                          }
                      }
          

           

          I just have to make sure that all my dataProvider XML contains the "isBranch" boolean attribute.