prismicio / javascript-singlepage

5 stars 10 forks source link

Sort does not work #2

Closed zoosky closed 9 years ago

zoosky commented 9 years ago

I tried this to get services sorted on their order attribute

            <div class="row">

                <script type="text/prismic-query" data-binding="services" data-query-orderings="[my.service.order]">
                    [
                        [:d = at(document.type, "service")]
                    ]
                </script>

                [% services.forEach(function(service){ %]
                    <div class="col-sm-4 item [%= service.getText('service.icon_color') %] text-center scrollimation scale-in">

                        <div class="service-icon"><i class="fa fa-[%= service.getText('service.icon_code') %]"></i></div>
                        <h3>[%= service.getText('service.name') %]</h3>
                        [%- service.getStructuredText('service.catcher').asHtml() %]

                    </div>
                [% }) %]

Unfortunately, nothing gets sorted...

Any idea how to solve this?

erwan commented 9 years ago

Hi,

This project is no longer maintained, I recommend you to use https://github.com/prismicio/baked.js instead.

I will add a disclamer on the front page.

zoosky commented 9 years ago

Ok. Great. Thanks for the pointer.

zoosky commented 9 years ago

I've looked at beaked.js. Unfortunately it's approach is an achitecture change. And it seems immature to me.

Can you give us a hint how to best solve the sorting problem?

dohzya commented 9 years ago

Sadly you can't do this without patching the code.

The query is called here. It needs to retrieve the query parameters you want to use (like data-query-orderings) and pass them to the prismic.io's form. Here is the baked.js commit doing this change.

I hope it will help you :-)