0 Replies Latest reply on Jun 14, 2007 12:13 PM by Garyl Woolworth

    Redraw tree using custom itemEditors

    Garyl Woolworth Level 1
      I am using a custom item renderer that basically allows the user to change the label of any leaf nodes inside of that tree. The leaf nodes are physical files inside folders and on itemEditEnd it updates the filename, however what isn't getting updated is after they've typed there new filename the tree isn't redrawing itself to show the new label until you close the parent folder and open it again. Does anybody happen to know on how you can make it so the tree recognizes the change in it's data and redraw itself? Here is the function I'm using of where I need the tree to re-draw. And help would be much appreciated.

      // Define the event listener for the itemEditEnd event to copy the
      // updated data back to the data provider of the Tree control.
      public function processData(event:ListEvent):void {

      // Disable copying data back to the control.
      event.preventDefault();

      // Set variables to pass to cfc
      var fileSrc:String = docTree.editedItemRenderer.data.label;
      var fileLocation:Object = docTree.getParentItem(docTree.selectedItem);
      docTree.editedItemRenderer.data.label = TreeEditor(event.currentTarget.itemEditorInstance).fileName.text;
      var newFileSrc:String = docTree.editedItemRenderer.data.label ;

      // Close the item editor.
      docTree.destroyItemEditor();

      // Notify the list control to update its display.
      docTree.dataProvider.notifyItemUpdate(docTree.editedItemRenderer );

      // Reset tree editability
      docTree.editable = false;

      // Validate tree and redraw if necessary
      docTree.validateNow();

      }