Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Exporting and Customizing the Table Of Contents Webpart

$
0
0

We have a site with Managed Metadata enabled. In that we have Term sets and 2 levels of Terms and every one has a unique page associated with it.

Building 1
====Floor 1
====Floor 2
========House 1
========House 2
========House 3
Building 2
====Floor 3
========House 4
========House 5
========House 6
====Floor 4
========House 7
Building 3
====Floor 5
========House 8
========House 9

Buildings - Level 1.

Floor - Level 2.

House - Level 3.

Now my requirement is : To show the name of Floors under it, if I am viewing any Building Page ; show the name of Houses under it, if I am viewing a floor page.

For Example, If I am viewing, Building 2, i should be able to see the links of floor pages for that building, (i.e) Floor 3 and Floor 4.
If I am viewing Floor 5 page, I have to see the House 8 and House 9 links there.

I went for the approach of using Table of Contents webpart. I am able to statically fulfill the requirement by giving the Full url on the "start with location" text box, when i edit the webpart.
Now i need to do it dynamically. (i.e) wherever this webpart is been placed, it should get the URL and pass it as a value to the"start with location" parameter.

First I tried with Page Layouts approach, I added this webpart using snippet gallery, and tried to customize it. Inside the page layout, I have to pass the page's url to the "AnchorLocation" parameter of the webpart.

Generally , Through javascript I can get the url of the page. But I am not able to do inside page layouts. My javascript function was not called, also i was not aware of the format(syntax)to pass value to the "AnchorLocation".

Then i tried exporting the webpart. I did that and I opened the .webpart file in visual studio. Here also I have to give value to the "AnchorLocation". I am not sure how to call my javascript and to pass value to the "AnchorLocation".

Any help would be much appreciated, Please let me know, if my explanation is not clear. 



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>