Unable to find pageNo control when %RemoveChild

13 views
Skip to first unread message

qiaopeng

unread,
Feb 27, 2009, 4:17:31 AM2/27/09
to InterSys...@googlegroups.com

Hi, All

I’m trying to append and remove ZEN components programmelly, following is my test code:

Method ClearControlAuto reports “tableNavigator: Unable to find pageNo control”, but ClearControl works well.

What’s wrong in method ClearControlAuto

BTW, it’s Cache for Windows (x86-32) 2008.2 DS (Build 615U).

 

XData Contents [ XMLNamespace = "http://www.intersystems.com/zen]
{
<page xmlns="http://www.intersystems.com/zentitle="">
<button caption="append" onclick="zenPage.AppendControl();"/>
<button caption="clear" onclick="zenPage.ClearControl();"/>
<button caption="clearAuto" onclick="zenPage.ClearControlAuto();"/>
<pane id="test"/>
</page>
}

Method ClearControl() As %String [ ZenMethod ]
{
       Set tHolder = %page.%GetComponentById("test")
       Set tTab= %page.%GetComponentById("mytable")
       Do tHolder.%RemoveChild(tTab)
       Set tnav= %page.%GetComponentById("tablenav")
       Do tHolder.%RemoveChild(tnav)
       Quit ""
}

Method ClearControlAuto() As %String [ ZenMethod ]
{
       Set tHolder = %page.%GetComponentById("test")

       for i=0:1:tHolder.children.Count()
       {
              Set tComp = tHolder.children.GetAt(i)
              If $IsObject(tComp)
              {

                     Do tHolder.%RemoveChild(tComp)
              }
              Set tComp=""
       }
       Set tHolder = ""
       Quit ""
}


Method AppendControl() As %String [ ZenMethod ]
{     Set tHolder = %page.%GetComponentById("test")
       Set tOTName = "mytable"
       Set tComp = ##class(%ZEN.Component.tablePane).%New()
       Set tComp.useSnapshot=1
       Set tComp.initialExecute =1
       Set tComp.pageSize=10
       Set tComp.maxRows=10
       Set tComp.sql="select sClass,sDescr from sqluser.test"
       Set tComp.id = tOTName
      
       Set tNavi = ##class(%ZEN.Component.tableNavigator).%New()
       Set tNavi.tablePaneId = tOTName
       Set tNavi.id="tablenav"
      
       Do tHolder.%AddChild(tNavi)
       Do tHolder.%AddChild(tComp)
      
       Quit ""
}

 

 

Regards,

Peng Qiao

peng

unread,
Mar 1, 2009, 4:56:57 AM3/1/09
to InterSystems: Zen Community
Hi, all
I have also tested in Cache' 2009.1.0.363.
It still reports "ZEN ASSERTION FAILURE:tableNavigator: Unable to find
pageNo control"
anyone can test my code?

Regards,
Peng

Vlado

unread,
Mar 2, 2009, 8:58:32 PM3/2/09
to InterSystems: Zen Community
Hi Giaopeng,

Here is how the Method ClearControlAuto can work:

Method ClearControlAuto() As %String [ ZenMethod ]
{

Set tHolder = %page.%GetComponentById("test")
for i=tHolder.children.Count() :-1:4
{
Set tComp = tHolder.children.GetAt(i)
If $IsObject(tComp){Do tHolder.%RemoveChild(tComp)}

}
Quit ""
}


And make changes here:

XData Contents [ XMLNamespace = "http://www.intersystems.com/zen" ]
{
<page xmlns="http://www.intersystems.com/zen" title="">
<pane id="test">
<button caption="append" onclick="zenPage.AppendControl();"/>
<button caption="clear" onclick="zenPage.ClearControl();"/>
<button caption="clearAuto" onclick="zenPage.ClearControlAuto();"/>
</pane>
</page>
}

Vladimir

qiaopeng

unread,
Mar 2, 2009, 10:00:17 PM3/2/09
to InterSys...@googlegroups.com
Thank you, Vladimir
Now, I know that I should remove them from the end.

BTW, I don't need to move the tree buttons into pane "test", just "for i=tHolder.children.Count():-1:0" is OK.

Regards,
Peng

-----邮件原件-----
发件人: InterSys...@googlegroups.com [mailto:InterSys...@googlegroups.com] 代表 Vlado
发送时间: 2009年3月3日 9:59
收件人: InterSystems: Zen Community
主题: [InterSystems-Zen] Re: Unable to find pageNo control when %RemoveChild
Reply all
Reply to author
Forward
0 new messages