[ 3 posts ]

Daniel Yang

  • Username: Damiel Y
  • Joined: Thu Apr 12, 2012 12:53 am
  • Posts: 6
  • Offline
  • Profile

Inline Editing of TreeView Node Labels

Post Posted: Thu May 03, 2012 12:07 am
+0-
I've made YUI TreeView accordingly with this example.

The main problem I have is auto hiding of editor when I click to another component into the same page. Let's say I have menubar and treeview, if I start to edit treeview node and then move focus (doing mouse click for example) to the menubar then my node editor is still on the page.

Can I hide node editor automatically after doing the steps above?

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: Inline Editing of TreeView Node Labels

Post Posted: Thu May 03, 2012 6:18 am
+0-
I guess that you may set a listener for a click on the document body and if it is not within the editor, you can call method _closeEditor:

http://developer.yahoo.com/yui/docs/YAH ... loseEditor

(it is a private method so you have to enable the Show Private Members checkbox to see it).

Use Dom's isAncestor to check whether the target of the click has the editor as its ancestor:

http://developer.yahoo.com/yui/docs/YAH ... editorData

http://developer.yahoo.com/yui/docs/YAH ... editorData

_closeEditor allows you to decide whether you want the content edited so far to be saved or ignored.

I don't really know how well it works because some other widget might be listening to a click and prevent it from bubbling all the way up to the document body.

Daniel Yang

  • Username: Damiel Y
  • Joined: Thu Apr 12, 2012 12:53 am
  • Posts: 6
  • Offline
  • Profile
Tags:

Re: Inline Editing of TreeView Node Labels

Post Posted: Thu May 03, 2012 9:09 pm
+0-
Thanks! That works for me.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron