AnsweredAssumed Answered

Populating an HTML <ul> <li> list using javascript and piwebapi

Question asked by Alberto Dellabianca Champion on Nov 4, 2016
Latest reply on Jan 5, 2017 by Alberto Dellabianca

Hi all,

I would like to populate an HTML <ul> <li> nested list using javascript/jquery and piwebapi reading from a PI AF structure.

 

Basically as an example if I have an AF tree like this

 

  • Root Element
    • Sub Element 1
      • SubSub Element 1
      • SubSub Element 2
    • Sub Element 2
      • SubSub Element 3
      • SubSub Element 4

 

 

I would like to generate this:

 

  <ul>

  <li>Root Element</li>

       <ul>

            <li>Sub Element 1</li>

            <ul>

                 <li>SubSub Element 1</li>

                 <li>SubSub Element 2</li>

            </ul>

            <li>Sub Element 2</li>

            <ul>

                 <li>SubSub Element 3</li>

                 <li>SubSub Element 4</li>

            </ul>

       </ul>

  <ul>

 

Is there anyone who has done something similar?

 

Ideally you would specify what is the AF root node and how many nested levels to populate (something similar to PI Web Part Treeview) and the piece of Javascript would call PI Web API and generate the HTML <ul> <li> elements.

 

Any help is appreciated

 

Thanks!

 

Alberto

Outcomes