1

Hi I want to deploy jslink file along with XSLTListView webpart inside a page.

The webpart is deployed in the page like the following:

 <WebPartPages:WebPartZone ID="main" Title="my zone" FrameType="TitleBarOnly" runat="server">
        <ZoneTemplate>
            <WebPartPages:XsltListViewWebPart runat="server" ID="AnnouncementsList" Title="Announcements" ListUrl="Lists/Announcements" ChromeType="None" JSLi >
            </WebPartPages:XsltListViewWebPart>
        </ZoneTemplate>
    </WebPartPages:WebPartZone>

How can I add a property for JSLink to this webpart? I can't seem to find it in the intellisense.

1

You won't get it there.

If you open a list view page in SPD, you'll get markup like below:

<WebPartPages:XsltListViewWebPart runat="server">
<ParameterBindings>
 </ParameterBindings>
<DataFields>
</DataFields>
<XmlDefinition>
<View Name="{955609D0-F518-43BD-ADDC-FEAB64B9F951}">
<JSLink>clienttemplates.js</JSLink><XslLink Default="TRUE">main.xsl</XslLink>
</View>
</XmlDefinition>
</WebPartPages:XsltListViewWebPart>
<--- Some Code omitted for brevity --->

As you can see, JSLink is applied to a view and not the webpart itself. Make sure you have a view tag within the webpart.

  • Thank you, so the Name for the view, where does it come from? How do I get that view name? Do I get it from the deployed list? – Brittany Rutherford Dec 10 '15 at 14:42
  • Instead of you writing the markup, you can let SP auto generate the markup by editing the page and adding the list view web part directly from designer. Or you could add it from the browser as well by adding a Web part zone in the page, adding the web part and just editing the web part to fill the jslink property. – Akhoy Dec 10 '15 at 17:00
  • I am using visual studio, am not using sharepoint designer. – Brittany Rutherford Dec 10 '15 at 18:29
  • Would need some more details. Are you creating an add in to deploy a list? Try following this article msdn.microsoft.com/en-us/library/office/jj220045.aspx? You can also add the list to a page and see the automatic markup created. There you'll have the view tag. – Akhoy Dec 10 '15 at 20:47
  • Also see anthony-verschraegen.blogspot.in/2013/04/…. I think this is what you're looking for. – Akhoy Dec 10 '15 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.