Here's a more detailed view of the problem. below is the sub that runs for find the child and replacechild. This is the replace for the first grid I have. The second grid is called PickList. I don't have the code for it here since when it runs after MyGrid (refreshContent sub) the child is gone, so it disappears from screen.
sub refreshContent() ?"in refreshContent" m.MyGrid=m.top.findNode("MyGrid") for i = 0 to m.top.getChildCount()-1 child = m.top.getChild(i) ?"CHILD "child.id" "i if child.id = "MyGrid" ?"MyGrid INDEX "i exit for end if end for
m.MyGrid.content = m.global.posterx.show m.top.replaceChild(m.MyGrid ,i) ?"REPLACEMENT "m.top.replaceChild(m.MyGrid ,i) m.programmarkupgrid.SetFocus(true) m.programmarkupgrid.visible= true ?"RESET CONTENT DONE" for q= 0 to m.top.getChildCount() - 1 ?"CHILD "m.top.getChild(q).id end for
Ok, I am not creating a new child, but setting the content to new content that was downloaded.
Below is the debug from the initial for loop thru the children. Notice it finds MyGrid at 15. Also not PickList at 14.
yeah it's a bit buggy! maybe what's happening is since you're replacing the item with itself it ends up doing two removals. Create a new node fresh and replace the old one, don't try to re-use it like that and I think it will resolve the problem.
Well joetesta, I think I tried it all with same result. Using the replacechild wants to remove the child preceding the child replaced. No idea why, actually put some dummy children in before it and with each pass of the loop it removed them and kept going up the tree. But after all this I did find a solution which may be helpful to others that may run into the same thing. I am making a copy of the existing child something like
this copies all existing info from old child. I then set my m.newchild.content to the new content. After this I removechildindex of the oldchild and append the newchild. This puts the newchild at the end of the children. By doing this, it no longer removes any other children in the list. No idea why replacechild doesn't work for me, but this seems to do the job. Thanks for looking over it with me and giving me ideas. It does load new content but the grid still doesn't update, not until the event occurs a second time then it updates the grid.