[URGENT] dynamic simple hierarchial tree view using Jquery to display sharepoint list items-Kindly help

sweetu ve 281 Reputation points
2020-07-30T07:06:21.85+00:00

i have below fields in SharePoint list and i need to read and display the list item in below tree view format

Tree view List

Name-Single line of Text
Category-Choice field

Name category Unique ID Parent ID
Apple Title 100
Avocado Main 101 100
Avo sub 102 101

Expected output(Sample)

-Apple
[] Avocodao
[] Avo

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,160 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,021 Reputation points
    2020-07-31T09:37:13.993+00:00

    It's impossible to achieve this just using JQuery, you have to use JSOM to achieve this. You need to create a new column named "Parent" for your list. This is a lookup column and it does look-up to its list.

    Below is my script demo for you, it is in the below demo.txt file. And you need to change the list name and column name in the code if necessary.

    14816-demo.txt

    Test result:

    14817-treeview.gif

    Reference:

    https://www.linkedin.com/pulse/display-category-list-tree-view-blog-site-sharepoint-hai-nguyen


1 additional answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,021 Reputation points
    2020-08-04T02:21:06.407+00:00

    I have updated my code in the below attachment, please check it.

    15413-demo.txt

    1 person found this answer helpful.
    0 comments No comments