[ 4 posts ]

jono

  • Joined: Fri Feb 04, 2011 11:52 am
  • Posts: 2
  • Offline
  • Profile

Inline editor - How to select contents by default?

Post Posted: Fri Feb 04, 2011 12:07 pm
+0-
I'm new to YUI and can't figure out how to make the inline edit select the contents by default when it is activated. I am applying it to a new tree branch that is a text node by calling the editNode(); node function. The inline editor appears but because the contents aren't selected so I have to delete the existing contents before typing the new name in the box.

Is there a function I can all to highlight the contents of the inline editor box?
Code:
//Called from a keylistener
function key_test()
{
  var branch = new YAHOO.widget.TextNode({label: 'name', editable:true}, treeRoot, false);
  tree.render();
  branch.editNode();   //activate the inline editor to change the node name
}

Alberto Santini

YUI Contributor

  • Offline
  • Profile

Re: Inline editor - How to select contents by default?

Post Posted: Fri Feb 04, 2011 12:17 pm
+0-
Hello jono.

Did you give a look at Inline Editing of TreeView Node Labels example [1]?

It seems the content is selected by default.

Hope that helps,
IceBox


[1] http://developer.yahoo.com/yui/examples ... _edit.html

jono

  • Joined: Fri Feb 04, 2011 11:52 am
  • Posts: 2
  • Offline
  • Profile
Tags:

Re: Inline editor - How to select contents by default?

Post Posted: Sat Feb 05, 2011 12:09 am
+0-
Hi IceBox,
Yes I saw this example and the inline editor appears with the contents selected when activated like this:

Code:
tree.subscribe('enterKeyPressed',tree.onEventEditNode)


However, when the inline is activated with a key listener like this, it doesn't work as expected. Am I missing something or is this a bug?
Code:
var key_ctrlN = new YAHOO.util.KeyListener(document, { ctrl:true, keys:78 },
                                       { fn:key_test,
                                         scope:tree,
                                         correctScope:true } );
key_ctrlN.enable();

Alberto Santini

YUI Contributor

  • Offline
  • Profile

Re: Inline editor - How to select contents by default?

Post Posted: Sat Feb 05, 2011 12:41 am
+0-
Hello jono.

The method fillEditorContainer [1] selects the text.

For a better explanation about that method you can read the topic "best approach for complex and huge forms using treeview" [2].

Regards,
IceBox

[1] http://developer.yahoo.com/yui/docs/YAH ... rContainer
[2] viewtopic.php?f=89&t=1979&view=previous
  [ 4 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