emberjs / list-view

An incremental rendering list view for Ember.js
MIT License
465 stars 116 forks source link

Inserting a view in front of the content list #179

Closed MaxSanKyu closed 9 years ago

MaxSanKyu commented 9 years ago

I want to add a search form at the top, which scrolls up with the list. Since it is a ContainerView I would have to add it as a child view at the first position, but I haven't quite figured out how to do this. Is this possible?

stefanpenner commented 9 years ago

yes, you can choose a view based on content index:

https://github.com/emberjs/list-view/blob/master/demos/multi-height-multi-view.html#L72-L74

the API isn't great, but it works.

MaxSanKyu commented 9 years ago

Sadly not exactly what I was looking for. Doesn't really work with grid view and I would have to add an empty first object in the content, which is not really optimal.

jdurand commented 9 years ago

@MaxSanKyu I managed to do something similar by using an array as the content for my list view. Each item specifies a template (or view) to render and list-view takes care of the rest.

capture d ecran 2014-12-10 a 11 55 02

Your controller can then just deal with the array and tell the list view to scroll at a specific position based on some user action.

stefanpenner commented 9 years ago

Doesn't really work with grid view and I would have to add an empty first object in the content, which is not really optimal.

but it works, this project isn't at the "polish phase" yet