Why it is not possible to filter on doc title in a livetable?

Last modified by Vincent Massol on 2013/02/09

Use case

When a livetable is created with doc.title as a column, by default that column does not show as filterable. When filtering is forced on the column by adding "filterable:true", the filtering field appears but typing in it has no effect. The property doc.name can be used and filtered as expected. The reason for this behavior is explained below.

Explanation

There are two different things that usually act as "title", doc.title and doc.displayTitle. The first one is an actual metadata field of the document, persisted to the database, while the latter is a dynamic field computed from different sources, including the doc.title field, headers in the content, the document name, and, more recently, other fields selected by the sheet used to display the objects in the document (a new feature of the new sheet mechanism). Plus, it could even be more dynamic, as in text generated by some Velocity code, in the most basic form a translation.

Livetable filters work directly on the database, meaning that they translate into sql conditions ("and doc.title like '%text introduced by the user%'"). The doc.title Livetable column is special, since it's not exactly the doc.title metadata, but a combination of doc.title and doc.displayTitle, so even though the computed display title is displayed, filtering and sorting works on the plain title. Given the very dynamic and unpredictable aspect of the display title, it's impossible to write a correct sql filter that would match the display title in all cases.

For this reason, by default the title isn't filterable, since it won't meet the user's expectations: it doesn't filter on the displayed title, but on the internal title. What's more, it can't be configured so that it filters on the right information all the time. For certain instances it would be possible to actually make the field filterable, but only when the documents displayed by the Livetable really use the document title as the only source of the displayed title.

For example, if you edit some of the displayed documents in wiki or wysiwyg mode and enter something in the document title field (the one above the content), you will be able to filter it in the livetable.

Tags:
Created by Guillaume Lerouge on 2012/02/08
   

Get Connected