PDA

View Full Version : Special chars - Ext.tree.TreeNode



marlo
23 Feb 2009, 1:44 AM
Hi all,

I have encountered a few problems connected with special chars while creating Tree under ExtJs 2.0. The problem is that if the name of the Node contains char like: < > # & \ ' " / and many others, than JavaScript Console displays errors, some of the nodes are not clickable, some of them don't display in tree (without name), finally some of these chars make error in JavaScript which prevents from displaying Tree at all.

We have already make a validation during creation of names for the nodes (now users are not able to put these chars into nodes names). However some of them have already made these 'invalid' names and they can't work with the Tree.

We create nodes using:
node = new Ext.tree.TreeNode({text:'"+ folder.getName() +"', cls:'station-node', allowDrag:true,id:'#"+ folder.getFullName() +"'});

My questions are:
- Is there a convinient method which takes name of the node (in my case 'folder') and converts special chars (from this name) into correct form (using some kind of escape chars or coding or sth else)?
- Where can I find help on this subject?

Greetings,
Marek