lundi 22 mai 2017

Ember JS Call component function from the route

I have a component that has a map on it. When this map is clicked a spatial query is performed and data is returned. The data is passed up to the route via action to update the model.

At this point a user can select any of these rows and when they do I would like to be able to notify the map-component which item has been selected. Currently I get the information from when the click action occurs. Here is where I am stuck. How would I go about letting the component know that row X has been clicked from the route?

I am very new to ember (2 weeks) so feel free to correct any poor design issues as well.

    //Component (my-mapview)
    import Ember from 'ember';
    export default Ember.Component.extend({
        mapView: null,

        actions:{
            onMapviewClicked){
                let data = mapView.Query();
                this.sendAction('identified', data);
            }
        }
    });

    //Route (application.js)
    export default Ember.Route.extend({
        model: function() {
            return {            
                identifiedData:[],
            };
        },
        actions:{
           onItemsIdentified(data){
               let model = this.get('currentModel');
               Ember.set(model, 'identifiedData', data);
           }
        }
    });


    //Template application.hbs)
    
    


    //Component (my-grid)
    import Ember from 'ember';
    export default Ember.Component.extend({            
    });




Aucun commentaire:

Enregistrer un commentaire