Welcome Guest Search | Active Topics | Sign In | Register

Rename TreeNode Options
TonyL
Posted: Sunday, July 27, 2008 1:18:20 AM
Rank: Member
Groups: Member

Joined: 7/26/2008
Posts: 15
Hi,

Is there a way to change a TreeNode to edit mode from code just like the user click twice on the node? I'm trying to add a new node then switch to edit mode programmatically so the user can enter a name for the node right away.

Thanks.
eo_support
Posted: Sunday, July 27, 2008 5:30:23 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Yes. You would need to call this function:

http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.TreeNode.beginEdit.html

In order to call this function, you will need to get a client side TreeNode object first. There are essentially two ways to get a TreeNode. One through index:

eo_GetObject("TreeView1").getTopGroup().getItemByIndex(0);

The other way through item path:

eo_GetObject("TreeView1").FindItem(itemPath);

You can find more information on how to use our client side API at here:

http://www.essentialobjects.com/ViewDoc.aspx?t=clientapi_howto.html

Thanks
TonyL
Posted: Sunday, July 27, 2008 9:53:59 AM
Rank: Member
Groups: Member

Joined: 7/26/2008
Posts: 15
Thanks for the info. Actually I trying to do this on the server side using VB. I know how to add a node to the SelectedNode, but can't figure out how to change the new node to edit mode. Can I do this on the server side as well?
eo_support
Posted: Sunday, July 27, 2008 10:14:23 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

What you would do is to render a small piece of JavaScript from the server side. For example, you can put a Label in the the form and then do this on the server side:

Label1.Text = "<script type='text/javascript'>EditNode('your_node_path');</script>";

This way when it comes to the client side, it will call a JavaScript function EditNode, which is a JavaScript function you would implement and use our client side JavaScript API to actually switch the node to edit mode.

Thanks
TonyL
Posted: Sunday, July 27, 2008 11:08:08 PM
Rank: Member
Groups: Member

Joined: 7/26/2008
Posts: 15
Thanks for the answer. I think I can take off from here, but I can't actually see it in action because I'm still evaluating your trial package and I guess this function is disabled. As long as I know this can be done that's good for now. Thanks!
eo_support
Posted: Monday, July 28, 2008 5:32:39 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

What you downloaded is the release build and everything should work:

http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=611

Thanks
TonyL
Posted: Thursday, July 31, 2008 10:40:04 PM
Rank: Member
Groups: Member

Joined: 7/26/2008
Posts: 15
Hi,

I'm trying to edit node text by clicking twice on the node and it works if I set RasieServerEvent property to False but doesn't work if it's set to True. Is this a limitation of trial version?
eo_support
Posted: Friday, August 1, 2008 6:28:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

The trial version has not feature restrictions. I believe this behavior is by design. As soon as RaiseServerEvent is set to true, the first click is interpreted as a postback to raises server event. So the second click doesn't even get the chance to be recognized as a edit action.

Thanks
TonyL
Posted: Friday, August 1, 2008 6:52:08 AM
Rank: Member
Groups: Member

Joined: 7/26/2008
Posts: 15

Is this means if I use ItemClick event I have to sacrifice the double-click edit method? Anyway I can have both working?

Thanks
eo_support
Posted: Friday, August 1, 2008 7:06:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
TonyL wrote:
Is this means if I use ItemClick event I have to sacrifice the double-click edit method?


That is correct. Under normal circumstance you are able to have both click and double-click when the click event doesn't post back the page. You would have the same result on a Button control that posts back the page. Simply put, if you jump once and the bridge collapses, you don't get to jump a second time.
TonyL
Posted: Friday, August 1, 2008 8:44:43 AM
Rank: Member
Groups: Member

Joined: 7/26/2008
Posts: 15
Ok, I guess that makes sense. In this case, I would have to use a separate button to call the beginEdit of the selected node then. That will work out fine too.

Also, I'm trying to avoid user to edit the root node. I tried the set parentNode's AllowEdit to False as follows:

parentNode.AllowEdit = NullableBool.False

but it didn't work, I still can edit it. Is there some else I have to do?

Thanks.
eo_support
Posted: Friday, August 1, 2008 9:15:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

Check your "parentNode". We tested it and we set the AllowEdit to false on the node that we do not want to edit. In this instance, the root node and it does disable the node from entering edit mode.

The trick part about this is, when you set a parent node's AllowEdit to false, it also set the default value of all children node's AllowEdit, unless this value is overriden again on the children nodes.

Thanks
TonyL
Posted: Tuesday, August 5, 2008 4:42:30 AM
Rank: Member
Groups: Member

Joined: 7/26/2008
Posts: 15
Hi,

Thanks for the previous message, I'll try again.

Now I'm trying to raise the ItemRenamed event but it wasn't raise right after I finish edit, instead it is raised when I click on the node again or other nodes.

I used the eo_GetObject('DirectoryTree').getSelectedNode().beginEdit(''); instead of double-click method with RaisesServerEvent set to True.

Is there something else I need to do?

Thanks
eo_support
Posted: Wednesday, August 6, 2008 8:51:39 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
TonyL wrote:
it wasn't raise right after I finish edit, instead it is raised when I click on the node again or other nodes.


I am not exactly sure what you mean by "right after I finish edit". From the TreeView's point of view, the edit finishes when you click on another node (so the editing node exists edit mode). Do you mean something else by "right after finish edit"?

BTW: I believe we have fixed \1 problem. We are hoping to have an update build this week. So all those problems should be fixed by then.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.