Create component to filter data from backend | Community
Skip to main content
ealmeida1
October 31, 2019

Create component to filter data from backend

  • October 31, 2019
  • 4 replies
  • 4962 views

Hey guys.

I'm new in adobe AEM. I'm trying to use the 6.5 version and figuring out how it works. So, I need to create a component to show a list of files and filter that files based on a drop down value. I'm looking for an example, but I didn't found some way to send values to filter a list in my back end. For now, I'm getting all the values from my @Model class, but I don't know how to send a parameter to filter that list. Is it possible? How is the best way to do that?

Thanks!

Eder

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

Ankur_Khare
Community Advisor
Community Advisor
November 1, 2019

I would suggest to create a servlet which will get called whenever u will change the dropdown value and pass the selected dropdown value when u call ur servlet and process ur result in ur java class and send back the result to ui for display.

ealmeida1
ealmeida1Author
November 5, 2019

Hi ka786,

Thanks for answer. I'm trying to follow this example https://aem.adobemarketingclub.com/implementing-use-interface-using-sightly-in-aem-6-x/ . But doesn't work, I'm receiving an error:

"org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Compilation errors in org/apache/sling/scripting/sightly/apps/test/components/structure/assets/assets_html.java:

Line 38, column 1733 : com.test.MyComponent cannot be resolved to a type". Do you have a better tutorial?

Thanks!

Ankur_Khare
Community Advisor
Community Advisor
November 5, 2019
ealmeida1
ealmeida1Author
November 5, 2019

Good!! I will try that.

One more question: Why I can't create a two way communication between @Model class and the htl page? Because I have some attributes in my model class and I need to access them. Is it correct put all that attributes in a servlet class?

Thanks for everything!