GOAL: I am trying to create a custom page layout based on a custom content type that contains 3 xsltlistviewwebparts which use custom views that were created for the lists in the browser.
I have successfully created the page layout from my content type, and added the 3 xsltlistviewwebparts to it.
In my html file I have the following snippet:
<!--SPM:<WebPartPages:XsltListViewWebPart ID="XsltListViewWebPart4"
runat="server" IsIncluded="True"
NoDefaultStyle="" Title="Pages/Contacts" FrameType="Default"
ViewContentTypeId=""
DisplayName="Contacts"
ViewGuid="{3D3974A3-AC3A-4284-9F1A-2F99DB986FF9}"
ListUrl="" ListDisplayName="" ListName="{F8BDEC5F-666F-405C-97E2-EF658DBA1DFB}" ListId="f8bdec5f-666f-405c-97e2-ef658dba1dfb"
AllowZoneChange="False" AllowEdit="False"
DisableSaveAsNewViewButton="TRUE" DisableViewSelectorMenu="TRUE" > -->
<!--SPM:</WebPartPages:XsltListViewWebPart>-->
ISSUE: I need this web part to use a custom view that I created for the list, but no matter what I try SharePoint uses the default view for the list when it translates the html snippet to aspx.
- I tried setting ViewGuid property in the snippet, but it didn't work.
- I tried saving a webpart that had the view already defined to the webpart gallery and adding that to the layout, but SharePoint still used the default view when it translated the snippet.
- I tried explicitly setting the view definition in the snippet, but SharePoint overwrote it when it translated the snippet.
- I tried just editing the translated aspx file to save time, but it ended up breaking the server and it doesn't seem like a good practice.
I've been playing around with javascript and trying to get it to change the view using the client side object model, but I have almost no experience with javascript and I know there has to be some way to set the view in the html snippet.
QUESTION: Is it actually possible to tell a xsltlistviewwebpart to use a custom view from the html snippet in the page layout html file? If so, how?