4

I am attempting to replicate the inline editing features found in the allitems.aspx page in a custom page layout. For whatever reason the "new" and "edit" list options don't seem to be showing up.

Here's a screen cap of what I want in my page layout:

What I need

The code in the layout page is as follows:

    <WebPartPages:XsltListViewWebPart runat="server" ViewFlag="" 
            ViewSelectorFetchAsync="False" 
            InplaceSearchEnabled="True" 
            ServerRender="False" 
            ClientRender="True" 
            InitialAsyncDataFetch="False" 
            WebId="00000000-0000-0000-0000-000000000000" 
            IsClientRender="False" 
            GhostedXslLink="main.xsl" 
            NoDefaultStyle="" 
            ViewGuid="{C70F3145-66F1-4D1C-BB99-D0CE9B54C405}" 
            EnableOriginalValue="False" 
            DisplayName="All Items" 
            ViewContentTypeId="" 
            Default="TRUE" 
            ListUrl="" 
            ListDisplayName="" 
            ListName="{07F51CB9-8571-4008-8872-9A082190D36A}" 
            ListId="07f51cb9-8571-4008-8872-9a082190d36a" 
            PageType="PAGE_DEFAULTVIEW" 
            PageSize="-1" 
            UseSQLDataSourcePaging="True" 
            DataSourceID="" 
            ShowWithSampleData="False" 
            AsyncRefresh="False" 
            ManualRefresh="False" 
            AutoRefresh="False" 
            AutoRefreshInterval="60" 
            Title="ProjectDetails" 
            FrameType="Default" 
            SuppressWebPartChrome="False" 
            Description="Project Details" 
            IsIncluded="True" 
            ZoneID="Main"
            PartOrder="1" 
            FrameState="Normal" 
            AllowRemove="True" 
            AllowZoneChange="True" 
            AllowMinimize="True" 
            AllowConnect="True" 
            AllowEdit="True" 
            AllowHide="True" 
            IsVisible="True" 
            TitleUrl="/11111/Lists/ProjectDetails" 
            DetailLink="/11111/Lists/ProjectDetails" 
            HelpLink="" 
            HelpMode="Modeless" 
            Dir="Default" 
            PartImageSmall="" 
            MissingAssembly="Cannot import this Web Part." 
            PartImageLarge="" 
            IsIncludedFilter="" 
            ExportControlledProperties="False" 
            ConnectionID="00000000-0000-0000-0000-000000000000" 
            ID="g_c70f3145_66f1_4d1c_bb99_d0ce9b54c405" 
            __MarkupType="vsattributemarkup" 
            __WebPartId="{C70F3145-66F1-4D1C-BB99-D0CE9B54C405}" 
            __AllowXSLTEditing="true" 
            __designer:CustomXsl="fldtypes_Ratings.xsl"
            WebPart="true" 
            Height="" 
            Width=""><ParameterBindings>
  <ParameterBinding Name="dvt_sortdir" Location="Postback;Connection"/>
            <ParameterBinding Name="dvt_sortfield" Location="Postback;Connection"/>
            <ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/>
            <ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/>
            <ParameterBinding Name="OpenMenuKeyAccessible" Location="Resource(wss,OpenMenuKeyAccessible)" />
            <ParameterBinding Name="open_menu" Location="Resource(wss,open_menu)" />
            <ParameterBinding Name="select_deselect_all" Location="Resource(wss,select_deselect_all)" />
            <ParameterBinding Name="idPresEnabled" Location="Resource(wss,idPresEnabled)" /><ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /><ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /></ParameterBindings>
<DataFields>
</DataFields>
<XmlDefinition>
<View Name="{C70F3145-66F1-4D1C-BB99-D0CE9B54C405}" 
    DefaultView="TRUE" 
    MobileView="TRUE" 
    MobileDefaultView="TRUE" 
    Type="HTML" 
    DisplayName="All Items" 
    Url="/11111/Lists/ProjectDetails/AllItems.aspx" 
    Level="1"
    BaseViewID="1" 
    ContentTypeID="0x" 
    ImageUrl="/_layouts/15/images/generic.png?rev=23" ><Query><OrderBy><FieldRef Name="ID"/></OrderBy></Query><ViewFields><FieldRef Name="LinkTitle"/><FieldRef Name="Rank"/><FieldRef Name="Division"/><FieldRef Name="Project_x0020_Status"/></ViewFields>
    <RowLimit Paged="TRUE">30</RowLimit>
    <JSLink>clienttemplates.js</JSLink>
    <XslLink Default="TRUE">main.xsl</XslLink>
    <Toolbar Type="Standard"/>

</View>
</XmlDefinition>
</WebPartPages:XsltListViewWebPart>

And this is what it looks like, no new item or edit list:

What I get

This was pretty much ripped from allitems.aspx. I'm obviously missing something. Is there some specific SharePoint control that is needed, or are these buttons enabled by some properties found in the XsltListViewWebPart? Any ideas?

Incidentally, an instance of the page layout is being dynamically generated using JSOM and landed in the /Pages list in a publishing sub site. Not sure if that has any bearing on the issue.

* UPDATE *

I've decided to abandon this approach and utilize the built-in system pages for displaying lists, libraries, etc with a custom master page wrapped around them. Seems to be the easier path. Plus this method includes all of the ribbon goodies, out of the box list features (like new and edit inline), with almost no fuss.

One thing I did find that was useful, however, is that you can embed controls in the File node within a module. A very important key in this is wrapping the webpart in a View element, which maps the view you want to the XsltListViewWebPart:

<Module Name="Pages" Url="$Resources:osrvcore,List_Pages_UrlName;" SetupPath="SiteTemplates\SPS">
    <File Url="default.aspx" Path="default.aspx" Type="GhostableInLibrary" ReplaceContent="TRUE" IgnoreIfAlreadyExists="FALSE" >
        <Property Name="Title" Value="Open Issues" />
        <Property Name="ContentType" Value="ProjectDashboardContentType" />
        <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/ProjectPortal-OpenIssues.aspx" />
        <Property Name="ContentTypeId" Value="0x01010007FF3E057FA8AB4AA42FCB67B453FFC100E214EEE741181F4E9F7ACC43278EE811009A4931CEF4F842B9BDFAF179837C58E2" />
        <View WebPartZoneID="ProjectPortalZone" WebPartOrder="0" List="Lists/ProjectTasks" DefaultView="FALSE" BaseViewID="6">
          <![CDATA[
            <webParts>
             <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                <metaData>
                 <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
                 <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
                </metaData>
                <data>
                 <properties>
                    <property name="AllowConnect" type="bool">True</property>
                    <property name="ChromeType" type="chrometype">None</property>
                    <property name="Title" type="string">Project Tasks</property>
                 </properties>
                </data>
             </webPart>
            </webParts>
         ]]>
    </View>

See this excellent blog post for more info: http://paulryan.com.au/2014/xsltlistviewwebpart-deploying-difficult-web-parts.

This got me something that looked like this: enter image description here

Still doesn't meet the original requirement, but it works for the needs of a few pages.

My takeaway from all of this: Use built-in SharePoint wherever and whenever possible. Make sure your designs take OOTB into account. This is especially true in SPO.

ALL THIS SAID: I am still interested if anyone knows the secret sauce to utilizing these XSLTListViewWebParts in a declarative fashion on a page layout.

Your Answer

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

Browse other questions tagged or ask your own question.