A strange JScript behavior

  • Thread starter Maris Janis Vasilevskis
  • Start date
M

Maris Janis Vasilevskis

Hi,

Of course, I know, that the old WebControls are unsupported (I use treeview.htc copyrighted 2000-2003)
However, it seems to be a JScript problem (I use IE 6.0 with all updates).
The problem seems to be with some too early destroy when function called in return statement.

My task is to find node index from node data at client side.
My solution:

function NodeIndexFromNodeData(parentNode,aNodeData) {
var children=parentNode.getChildren();
var i,n=children.length;
var node, nodeData;
var s;
for(i=0;i<n;i++) {
node=children;
nodeData=node.getAttribute("NodeData");
// s=node.getNodeIndex();
if(nodeData==anodeData) return node.getNodeIndex();
s=NodeIndexFromNodeData(node,aNodeData);
MyDebugOutput('s='+s);
if(s) return s;
}
return '';
}

As written, MyDebugOutput shows s=null after correct data found.
If I uncomment the nonfunctional assignment before return, everything works.

Any ideas?

Mahris

P.S. I have also a true TreeView problem. Maybe somebody has any experience with the unsupported version?
I cannot retrieve text attribute from a node which never has been visible.

I create my tree at server side (NET 1.1) with a command set like
node=new TreeNode();
node.Text=sometext;
node.NodeData=anothertext;
ParentNode.Nodes.Add(node);

When I process the tree at client side, I can apply to a node commands
node.getAttribute("NodeData");
node.getNodeIndex();
However, node.getAttribute("Text"); throws exception.

My current workaround: set "expanded" to true for all nodes till desired, and only then
node.getAttribute("Text");

I wonder whether anybody knows some way to activate attributes without visual expanding.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top