cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Document Library Filter

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi All,

I have a client requirement to implement a custom filter in the Document Librarary's  left navigation pane. Users should be able to filter the content under Document Library by Content Type and their respective metadata.

While going through the Alfresco.component.BaseFilter implementation, it looks like it will work only with anchor tags (<a>), but we are planning to implement the custom filter component using checkbox controls. Basically, the filter query will keep building when user selects/deselects the checkboxes.  Also, how can we support multiple hierarchies in the Filter UI as shown below

Content Type -1
     Metadata-1
     Metadata-2
Content Type -2
      Metadata-1
      Metadata-2

I understand that the Base Filter could be extended to achieve the above, but  just wanted to hear your thoughts.

Thanks
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

you are correct in that base filters will only work on anchor tags (as triggers). That does not mean you can't achieve what you desire to do - we did something similar for a customer not too long ago. For our configurable filter we added a configuration dialog via a small icon in the entry (catching any click on the icon via JavaScript before it caused the filter to trigger). Changes made in the dialog (e.g. choosing a user ID) resulted in updates of the "rel" attribute on the anchor tag - which contains the effective filter setting - and automatically triggered the filter with those new settings.

Your hierarchy appears suggests facetted search rather than a fixed set of semantical filters. Regardless, it should be easy to support this - you only need to define a filter setting "syntax" that can combine the two distinct settings for type and metadata, have a proper setting string ("rel" attribute) constructed by your configuration widget(s) and evaluate it accordingly in the filter.lib.js on the Repository side.

Regards
Axel

unknown-user
Champ on-the-rise
Champ on-the-rise
Thanks Axel for the quick response.

In fact I thought about implementing it through a configurable dialog that opens up on a button click.  But the client needs the filter to be in the left navigation pane so that its intuitive to the user.

After digging further into the Base Filter, I am thinking of creating a custom Base Filter that supports checkboxes and generate the filterId based on the check box selections. Will keep you guys posted…

Thanks again for your response, that gives me a confidence that I am in the right direction.

Jerry