I am creating a tree that I am dynamically loading the children for.
Each list of children for a node represents a web service call that I
must make, so I don't know how many children are present until the
children are loaded. I was trying to lazy load these guys based on
when they are asked for (so I put the loading code in the
getChildren() method).

To make sure the '+' sign was drawn, I returned '1' as the child count
if the children were not loaded. I made it so toggling expansion is
done via AJAX. The problem occurs if I exand a node with no children.

Example (before):
- A
 + B
 + C

I click on the + for 'B' which actually has no children on the server and I get:

- A
 - B
   - B
   - B
   - B

The grid lines get lost 'in space' after B, and C is never rendered.
If I refresh the page, the tree is accurate:

-A
 -B
 +C

It just really doesn't like me reporting '1' as the child count and
then returning 0 children later. Is there a way I can get it to accept
this fake node count and not blow up upon re-render? I would rather
not have to pre-pull one more level from the server if I don't have to
(in this case, I would have to load B and C which would be 2 web
service calls, so depending on the number of children, that could end
up being several web service calls and not good for performance).

Thanks,
Andrew

Reply via email to