Shared filters AND model Records can be viewed as tree

I’m working on an existing project that has set its Pages model “how should we order this collection of records?” option as “records can be organised in a tree by editors

The pages model contains pages for multiple distinct parts of the website. As such, I want to have top level folders in the content nav with sub pages folder.

I believe i could do this with the “Apply saved shared filter” option in the content nav settings for the menu item.

So the issues I have are…

I can’t create a saved search filter because the current model is set to Tree view. Which doesn’t let you create filters.

To solve this i want to do the following.

  1. change the model collection ordering to “default ordering
  2. create the shared filters
  3. set the model collection ordering to As a tree

[Edit] After some investigation i’ve updated my questions and current status…
Question 1 – Can i switch the collection ordering on a model without loosing data?
I do not know what will happen with the current tree view layout data if i turn it to standard view.
Will it retain the current nesting? or will it loose its previously organised state?

Seems switching collection ordering on a model brings up warning that all data will be lost. So this is not possible.

Question .2 – Can i filter models with models collection ordering set to As a tree?
When I put the model collection ordering to treeview, and i click the left hand nav with it set to use the shared filter. Will the pages be filtered? So i only see the pages in that section, in the tree view layout.
No, this doesn’t currently work. Can create a filter using code, but it doesn’t filter when in tree view.

Request. It would be good if you had an option to create a filter in the treeview layout.

  1. Would be nice if we can filter models where collection ordering is set to tree mode.
  2. Would be good if we didn’t have to use code to create filters when model is displayed as a tree.
  3. Would be good if we could switch collection ordering , to manage different editing requirements, without loosing the data.

Perhaps this is too much of an edge case to support. But its sort of where i’ve ended up. Basically my only alternative is to create a seperate Page model, which aint happening.


Ah, so i had a test account i could quickly model and tried it and got this warning.

So different question.

  1. Is it possible to create a shared filter when a model is in tree view?
  2. Will a shared filter work in conjunction with tree view.

So I wrote a script to create a filter using the API.

The code creates the filter and works for models without the view mode set to TreeView. However when I apply this to a model set to display in TreeView mode, it doesn’t filter the pages out. (i test this with two left hand nav items set to use two different filters to filter on the title containing ‘site A’ or ‘site B’.

Additionally, an issue unresolveable is i want to filter on a field in a block. Which i also don’t think is supported yet.

import { buildClient } from '@datocms/cli/lib/cma-client-node';

// export default async function (client: Client): Promise<void> {
//   // DatoCMS migration script
// }
(async function () {
  const client = buildClient({ apiToken: '<API-KEY>' });

  // const itemTypeFilters = await client.itemTypeFilters.list();
  const itemTypeFilter = await client.itemTypeFilters.create({
    name: 'Site B Page Filter',
    filter: {
      query: '',
      fields: {
        title: {
          matches: {
            pattern: 'site B',
            case_sensitive: 'false',
            regexp: 'false',
    shared: true,
    item_type: {
      type: 'item_type',
      id: '2077829',

  console.log(JSON.stringify(itemTypeFilter, null, 2));