By default the Table of Contents will list every page in the datasource, dividing it into sections and articles, and the Paged Doc Control will present every page in the datasource sequentially for viewing.
It is possible, however, to filter the datasource so a subset of pages is visible in either of these. As an example imagine a Pugpig-based app whose datasource is comprised of pages that are either index pages, articles pages or advertisements.
Key: In = Index, A = Article, Ad - Advertisement
Let’s take the example of filtering for the Table of Contents. We only want to see Index pages in the ToC. We can do this by filtering the content in the datasource based on it’s level.
Reference this page Atom Document Type to understand the composition of the feed datasource. Pay particular attention to the Entry Fields and the three atom:category properties. They are defined by their schema of section, pagetype or level. Any of these 3 can be used as the basis for determining how to filter your datasource and much will depend on the taxonomy of the feed.
Returning to the example of a filter by the type of the page, the goal is to split the datasource so we end up with 2 filtered datasource objects with their own sequential page numbers, the table below illustrates the relationship to the standard datasource page numbers.
|Index Page Number||0||-||-||-||-||-||1||-||-||2||-||-||-|
|Article Page Number||-||0||1||2||3||4||-||5||6||-||7||8||9|
|Original Page Number||0||1||2||3||4||5||6||7||8||9||10||11||12|
Creating a reference such as the table above also gives you a way to map back find what a pages original page number in the datasource is and map forward to discover if a page is of a specific type.
Uses for filtering
Applying a filter to the datasource allows you to be more flexible in what information you present to the user and allows you to 'layer' the content.
Considering the controls supplied in the Pugpig iOS SDK, the Table of Contents and the Paged Document Controller but have datasource variables. The ToC could be filtered to show just the section of an issue or the filter could ensure adverts do not appear in the list. The Paged Doc control could then show just articles in a particular section for a more targeted and concise experience.
Alternatively you could have multiple instances of these controls each with their own datasource, an example would be to have a page control that showed the section pages which provide overview and links to the section content. These links would then load a second page control which would contain the articles for that section.