HeroicEric / ember-group-by

An Ember addon that adds a computed property macro for grouping objects by a given property.
MIT License
53 stars 17 forks source link

groupBy live reloading? #1

Open kcollignon opened 9 years ago

kcollignon commented 9 years ago

I was wondering if it would be possible to use the group by functionality and have it automatically update its content when a new model gets added to the store?

HeroicEric commented 9 years ago

Can you provide an example of what you mean?

kcollignon commented 9 years ago

@HeroicEric sure! I should've included that in the original writeup.

I have a grouped list...

screen shot 2015-04-21 at 10 22 51 am

When I create a new record, it does not automatically get added to the list. I must refresh the page in order to see the new grouped record appear.

This is the code in my ArrayController:

documentFormatsByCategory: groupBy('model', 'category')
HeroicEric commented 9 years ago

Hmm. How are you creating the new record?

kcollignon commented 9 years ago

I have an action in my controller that creates it using Ember data and form fields.

actions:
    createDocumentFormat: ->
      fields = @get('fields')
      fields.organization_id = @get('controllers.application.selectedOrgId')
      fields.category = @get('selectedDocumentFormatType')
      format = @store.createRecord 'document_format', fields
      format.save().then (format) =>
        @transitionToRoute 'document_formats'
roncodes commented 7 years ago

I need this as well, any update on how to accomplish this?