database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
ㆍCache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Cache Q&A 374 게시물 읽기
No. 374
[Zen] ZEN Component 동적 추가/제거하기
작성자
구글그룹스
작성일
2009-03-18 12:20
조회수
4,161

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/zen" title="">
<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 
-----------------------------------------------------------------------------

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 

<트랙백 주소:http://groups.google.com/group/InterSystems-ZEN/browse_thread/thread/edca4cb2e137aeee#>

[Top]
No.
제목
작성자
작성일
조회
377[Zen] Chart 가운데로 정렬하기
구글그룹스
2009-03-18
4214
376[Zen] Tab에 Zen Page 삽입
구글그룹스
2009-03-18
3928
375[Zen] Zen Reports 자동 출력하기
구글그룹스
2009-03-18
4159
374[Zen] ZEN Component 동적 추가/제거하기
구글그룹스
2009-03-18
4161
3732009.1 Field Test 다운로드 하기
CacheDB
2009-03-18
4042
372[Cache] 완전초보 질문입니다 ㅠㅠ [2]
한민용
2009-03-17
4026
371[Cache]PDF로 인쇄하기
구글그룹스
2009-03-16
4835
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2019 DSN, All rights reserved.
작업시간: 0.070초, 이곳 서비스는
	PostgreSQL v11.5로 자료를 관리합니다