mardi 2 janvier 2018

Creating model attributes at run time in ember

I am creating an ember application where i want to implement a table built with ember. I am able to create a table using ember-models-table,and i am already able to render the table with column list and data. Now the problem is that the column list is coming from server and in ember-data i need to put all the columns as attributes in a model in order to show the data, so can someone help me in loading the column list in ember model at the run time.

my contoller is as follows

self.get("store").query("user",{page:1,pageSize:10}).then(function (data) 
            {
                self.set("data",data);
            });

my user model is as follws

/* With this it works */    
index: DS.attr("number"),
firstname: DS.attr("string"),
lastname: DS.attr("string"),
age: DS.attr("number"),
city: DS.attr("string")

/* but i want these attributes to be dynamic based on server response */




Aucun commentaire:

Enregistrer un commentaire