7

I was just wondering if there is a way to filter the timeline web part, so that it does not show completed tasks for instance? I have tried adding a filter to the task list that the timeline belongs to, but that only filters the list view and not the timeline

1

Umh, to be honest I don't think there is an easy way. The timeline information is stored as XML in the Task list. If you have look at the get_rootFolder().get_properties(), you'll find an item named Timeline_Timeline.

From the SP.UI.Timeline.ListTimelineDatasource you'll find options for add and remove. To remove you can use: SP.UI.Timeline.ListTimelineDatasource.RemoveItemsFromTimeline

If you have look in the debug file, it defined like this:

SP.UI.Timeline.ListTimelineDatasource.RemoveItemsFromTimeline(listId, viewName, itemsToRemove);

The viewName is always Timeline

The listId is the GUID, without brackets and lower case.

The itemsToRemove is an array of items, defined like this:

[{ 'id': itemId }]

So you'll probably have to check items in the list that are completed and use this function.

Example:

SP.UI.Timeline.ListTimelineDatasource.RemoveItemsFromTimeline('e57a22a5-2c04-473f-b145-60b0bbf88e14','Timeline',[{ 'id': 4}]);

The other option is to change the XML, but the cleanest of the two is maybe to use the function provided in SP.UI.Timeline and let that deal with the XML.

Here is an exmaple of how the XML looks like:

<TLViewData>
    <fmtSet>
        <fmt id="0" clr="FFEE2222" thm="0001" t1="0" t2="1" type="0" />
        <fmt id="1" clr="FFEE2222" thm="0001" t1="2" t2="3" type="1" />
        <fmt id="2" clr="FFEE2222" thm="0001" t1="4" t2="5" type="2" />
        <fmt id="3" clr="FFEE2222" thm="0001" t1="6" t2="7" type="3" />
    </fmtSet>
    <fltSet>
        <ft id="{00000000-0000-0000-0000-000000000000}" uid="4294967295" uidSrc="1" onTL="0" fmt="1" y="4294967282" x="0" h="20" />
        <ft id="{034D880B-3E2E-45A2-9021-5FD9ED1AAAB2}" uid="2" uidSrc="1" onTL="0" fmt="1" y="4294967282" x="0" h="20" />
    </fltSet>
    <tskSet>
        <t id="{00000000-0000-0000-0000-000000000000}" uid="4294967295" uidSrc="1" onTL="0" fmt="0" ch="4294967295" />
        <t id="{DD7582D6-5633-4395-88EA-BD5DF4B66856}" uid="4" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
        <t id="{D3FAEA5C-882B-4C7B-99CC-B97D3635C855}" uid="1" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
        <t id="{034D880B-3E2E-45A2-9021-5FD9ED1AAAB2}" uid="2" uidSrc="1" onTL="1" fmt="0" ch="4294967295" />
    </tskSet>
    <options dateFormat="255" panZoomT="9" ProjSummFmt="3" showDates="1" showProjSummDates="1" showToday="1" showTS="1" timelineHeight="133" timelineWidth="-1" timescaleT="8" todayT="10" />
    <mlSet>
        <m id="{00000000-0000-0000-0000-000000000000}" uid="4294967295" uidSrc="1" onTL="0" fmt="2" y="35" x="0" />
        <m id="{DD7582D6-5633-4395-88EA-BD5DF4B66856}" uid="4" uidSrc="1" onTL="1" fmt="2" y="35" x="0" />
        <m id="{D3FAEA5C-882B-4C7B-99CC-B97D3635C855}" uid="1" uidSrc="1" onTL="1" fmt="2" y="35" x="0" />
        <m id="{034D880B-3E2E-45A2-9021-5FD9ED1AAAB2}" uid="2" uidSrc="1" onTL="1" fmt="2" y="35" x="0" />
    </mlSet>
    <txtSet>
        <style id="0" type="0" clr="FFEE2222" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
        <style id="1" type="1" clr="FFEE2222" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
        <style id="2" type="2" clr="FF999999" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
        <style id="3" type="3" clr="FFB3B3B3" thm="0001" sz="8" font="Segoe UI Light" bold="0" ital="0" und="0" strk="0" />
        <style id="4" type="4" clr="FF525051" thm="0001" sz="10" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
        <style id="5" type="5" clr="FFB3B3B3" thm="0001" sz="8" font="Segoe UI Light" bold="0" ital="0" und="0" strk="0" />
        <style id="6" type="6" clr="FF999999" thm="0001" sz="9" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
        <style id="7" type="7" clr="FF999999" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
        <style id="8" type="8" clr="FF999999" thm="0001" sz="8" font="Segoe UI" bold="0" ital="0" und="0" strk="0" />
        <style id="9" type="9" clr="FFFFA614" thm="0001" sz="8" font="Segoe UI Semibold" bold="1" ital="0" und="0" strk="0" />
        <style id="10" type="10" clr="FFFFA72B" thm="0001" sz="10" font="Segoe UI Semibold" bold="0" ital="0" und="0" strk="0" />
    </txtSet>
</TLViewData>
  • All give the first option a try! I agree, changing that xml does not seem like a good idea – Pantani Jun 5 '14 at 11:24

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.