1

I'm fairly new to CraftCMS and am stuck with a little filtering issue. I'm trying to filter a page of entries by a custom field. I'd like to use Ajax so there is no page reload. Here's how I have the filtering links setup:

<a href="#" title="Entry Date">Entry Date</a> //postDate asc
<a href="#" title="Source Date">Source Date</a> //sourceDate asc
<a href="#" title="Scenario Date">Scenario Date</a> //scenarioDate asc

Both sourceDate and scenarioDate are text custom fields.

My current template is setup like this:

{% extends "_layout" %}
{% block content %}

{% paginate craft.entries.section('research').limit(12).order('sourceDate asc') as pageInfo, pageEntries %}
{% for entry in pageEntries %}

// post entry code

{% endfor %}

{% endblock %}

So my thinking is that when a user clicks on one of the filtering links, the order would change, and reload the paginated entries based off the new order (postDate asc, sourceDate asc, scenarioDate asc).

Since I'm really new to CraftCMS, I don't really know where to begin tackling this task. Any help is very appreciated.

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.