Question
· May 14

dynaTree looping

Hi Guys

I'm using the below to populate a tree to just show the root with a folder icon but whenever I click on a folder it loops back to the original folder, how can I disable the root folder from expanding to the next, I only want to show the main opened root folder and not to go any further?   

<dynaTree OnGetTreeInfo="GetTreeInfo" showLabel="true" id="editLocTree" onclick="zenPage.setData(zenThis.value)showLines="false"/>


Method GetTreeInfo(pRoot As %String, Output pTree, ByRef pParms) As %Status
{
Set MyId=..GetId,pos=1
&Sql(Select Name,ID into :name,:id from MSDS_COM.Loc where Parent=:MyId)
Set:SQLCODE (name,id)=""
Set pTree(0,"ch",1) = ""
Set pTree(1) = $LB(name,id,1,"","")
Quit $$$OK
}

 

Thanks

Product version: Ensemble 2018.1
Discussion (1)1
Log in or sign up to continue

Try this:

ClassMethod GetTreeInfo(
  pRoot As %String,
  Output pTree,
  ByRef pParmsAs %Status
{
  Set MyId=..GetId,pos=1
  &Sql(Select Name,ID into :name,:id from MSDS_COM.Loc where Parent=:MyId)
  Set:SQLCODE (name,id)=""
  if pRoot=""
  {
    Set pTree(0,"ch",1) = ""
    Set pTree(1) = $LB(name,id,1,"","")
  }
  Quit $$$OK
}

For further examples, see the class ZENTest.DynaTreeTest in the SAMPLES namespace.