Declaritively hide a task list's timeline
-
29-09-2020 - |
Question
I am trying to hide a task list's timeline declaritively, either in the View or XSLTListViewWebPart. The XLSTListViewWebPart is being added via a module and file, like so:
<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>
</File>
Is there a property that can be added to remove the timeline here? Or perhaps it's something that has to be set in the view that is referenced by BaseViewId="6"?
* EDIT *
I suppose I could just output some CSS or do some clever jQuery that'll hide that entire area, but would rather remove it from rendering altogether.
Solution
Ok, I was able to do this by removing the TimelineDueDate column from the View definition in my list schema:
<View BaseViewID="2" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,Late_Tasks;" MobileView="True" MobileDefaultView="False" Url="late.aspx" ReqAuth="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/15/images/issuelst.png?rev=23">
<Toolbar Type="Standard" />
<JSLink>hierarchytaskslist.js</JSLink>
<XslLink Default="TRUE">main.xsl</XslLink>
<JSLink>clienttemplates.js</JSLink>
<RowLimit Paged="TRUE">100</RowLimit>
<ViewFields>
<FieldRef Name="Checkmark"></FieldRef><FieldRef Name="LinkTitle"></FieldRef><FieldRef Name="StartDate" /><FieldRef Name="DueDate"></FieldRef><FieldRef Name="AssignedTo"></FieldRef><FieldRef Name="Status" /><FieldRef Name="pdTaskType" /></ViewFields>
<ViewData>
<FieldRef Name="PercentComplete" Type="StrikeThroughPercentComplete"></FieldRef>
<FieldRef Name="DueDate" Type="TimelineDueDate"></FieldRef>
</ViewData>
...
Just remove the DueDate FieldRef from ViewData, and it works!
OTHER TIPS
If you add your webpart using xml (like in the .webpart files) you can add the following property
<property name="ShowTimelineIfAvailable" type="bool">False</property>