mardi 14 août 2018

ember has many with async true

I has many relation in my ember app but it is not working recursively. here is my model. -->tree.js

>  export default DS.Model.extend({
>           parent  : DS.attr(), 
>           parentId : DS.attr('number', {defaultValue: "0"}),
>           childrens: DS.hasMany('menu', {async:true}),    
>           name    : DS.attr(),
>     });

route code-->

> export default Ember.Route.extend({   
>     model: function() {   
>         return this.store.findAll('treeview');       
>     }  });

hbs-->>


<div class="col-lg-12">


  
    
    <div class="col-lg-12" style="margin-left:30px;">
      
    </div>  
    
    
 
</div>


sub-tree-view component js file -->

    > showRecord:function(){  
let self = this; 
  let tree = self.get('tree');
    >     var test = tree.get('childrens'); }.property(),

But it not calling the model again with children id . With hasmany relation it should call the menu model recursively but it is not making the request again. How to deal with the has many relationship data.?




Aucun commentaire:

Enregistrer un commentaire