PDA

View Full Version : TreeEditor: different value for inline editing



timba
23 Nov 2010, 5:20 AM
Hi,

I am very new to Extjs and impressed by its power and possibilities. Maybe the nearly neverending options are the reason for this post.
I have a working tree, this was not an impossible task, but now I have no clue to solve my problem. If the name of my tree node is to long, I split the name to max. 10 characters and add three points at the end (eg. this_is_a_very_long_name_and_needs_to_split will be this_is_a_...). This spliting will be done before I render the node. Every node is editable.

Is it possible to set a different value then the displayed name for the inline edit mode?
If I have the displayed name eg. this_is_a_... I will have this_is_a_very_long_name_and_needs_to_split as value.

I tried this:
editNode : function() {
var tree = this.getOwnerTree();
tree.editor.field.startValue = " this_is_a_very_long_name_and_needs_to_split";
tree.editor.triggerEdit(this);
},This function gets called and I come into the edit mode, but I didnīt get the long name display in the input field.

Does anybody have the same problem or a solution for me?

Thanks for your help,
cheers
Timba

Condor
23 Nov 2010, 5:40 AM
You would have to extend TreeEditor and override the triggerEdit and updateNode methods.

timba
23 Nov 2010, 6:07 AM
Hi Condor,

thank you for your quick reply. Sorry, can you please explain the goal of overriding the triggerEdit function? :s

Condor
23 Nov 2010, 6:22 AM
triggerEdit currently fills the editor with node.text (and you want a different attribute).
updateNode updates the node.text with the editor value (and you want to update a different attribute and set a trimmed text).

timba
23 Nov 2010, 6:27 AM
aaah! Ok, thatīs great! I know what you mean, thanks for your help :)