AnsweredAssumed Answered

Share - filter out nodes based on custom property

Question asked by filip on Nov 9, 2016
Latest reply on Nov 9, 2016 by filip

Hello everyone,

 

I am struggling with implementation of a filter which would display only specific nodes under a folder.

Let's be more specific: I have custom type with property called status. This property can have values such as Draft, In Review, Approved, ... It is set by constraints by the content model. Then I will go to folder ABC under a site and my goal is to create an action in Share that would display only Approved files under the folder ABC.

 

At first, I checked Options -> Hide/Show Folders functionality. If I understand that well, it works in following way:

  • documentlist.js will build URL for Share webscript in _buildDocListParams and then it will send a request in _updateDocList
  • surf-doclist.get.js (more accurately surf-doclist.lib.js) is called on Share side. Among other things, it will construct URL for Alfresco webscript "/slingshot/doclib2/doclist/" with help of DefaultDoclistDataUrlResolver
  • Alfresco webscript "/slingshot/doclib2/doclist/" returns proper nodes in JSON format

 

So far, I created an extension module which adds my custom filter buttons under Options tab. Then I extended default Alfresco.DocumentList by a new one in my custom JS so I am able to react on clicked custom filter. And here I stopped because I did not find any easy way how to extend it for my custom property.

 

Maybe, I could create a new DataUrlResolver or totally a new logic which would requite changes in custom JS, similar Share webscript as "surf-doclist.get.js" and finally Alfresco webscript (similar to "slingshot/doclib2/doclist") to return only relevant nodes.

Another solution, which can be consider as "nasty hack" can be to extend surf-doclist.lib.js and do changes directly in model.json. So it would remove not needed nodes as a post processing method.

 

By the way, I tried to extend filters on left side (similar to All documents, I'm Editing, ...) but they will filter out everything for a whole site, not only for a specific folder.

 

Do you know what is a correct approach to create such filters?

 

PS: I am using 5.1.

 

Thank you for comments,

Filip

Outcomes