Filter Expression on Download List

Posted by Community Admin on 04-Aug-2018 21:44

Filter Expression on Download List

All Replies

Posted by Community Admin on 27-Jan-2014 00:00

Two part question:

#1 - I have a download list on a page that displays pdf documents from a Documents and Files library. Is there a way to dynamically update the filter expression on the Download List based on a click event by a user? The reason I ask is I have an A - B - C listing and when users click on the letter "A" only the pdf's that begin with the letter "A" should be displayed. When they click on the letter "B", only the documents that begin with "B" are displayed and so forth. 

#2 - On the filter expression of the download list what should I add to return documents begining with a letter? Is there a Title.BeginsWith("A")? I have seen and used Title.Contains("A"), but that just returns all documents that have an "A" in their name.

Thanks.

Thanks.

Posted by Community Admin on 28-Jan-2014 00:00

Update:
#2 - So using Title.StartsWith("A") and adding it to the FilterExpression property of the Document List lists only the documents that begin with the letter passed, in this case the letter A.

Back to #1 - How do I pass the letter I want to filter by to the document list? Should I just build 20+ pages for each letter of the alphabet? Not wanting to go this route of course. Any suggestions?

Posted by Community Admin on 30-Jan-2014 00:00

Hi Reynaldo,

In order to achieve your needs you need to update the WidgetTemplate.

You could list all the documents and implement some JavaScript logic to hide the files you do not need on the page. This is under: Download List widget > Edit menu > Settings > Edit thumbnail list template.
Add a TextBox and a Button on the template for example and adding at the end your JavaScript logic:

<script type="text/javascript">
  // implement your logic here
</script>

Alternatively, you could do this by extending the server-side logic in the template code behind. To do so you need to:
- Create a new WebUserControl - for the mark-up get the code for the template you need under: Download List widget > Edit menu > Settings > Edit thumbnail list template.
- Add the code behind logic you need
- Build the solution
- Map this new template (in the example below 'MasterListView' for selected type 'List')
Short video demonstration could be found here.

Than you need to add your logic for filtering or searching in the code behind and build the solution. In addition, for query documents you could check this article.

Regards,
Svetoslav Manchev
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 30-Jan-2014 00:00

Thanks for the reply Svetoslav.

The first option we have already implemented and hide/display documents based on user click of a link with CSS and JS. The caveat to that was that it would only filter the documents on the current page and our client has 800+ documents that we are filtering thru. So displaying them all on one page was not to their liking and paging was requested to list the documents. I'll look at your alternate solution and see if I may go that route.

Thanks for your help!

Posted by Community Admin on 31-Jan-2014 00:00

Hello Reynaldo,

Thank you for your feedback.

Please do not hesitate to get back to me if any problems persist, I'll be glad to assist you further.

Regards,
Svetoslav Manchev
Telerik

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed