Please, how to set teams via js ?
I what to set entity teams by user teams
I try to set teamsNames and teamsIds, only teamsNames and so on.
The result in attach
full code (last version):
this.listenTo(this.model, 'change', (model, options) => {
debugger;
if (this.model.hasChanged('assignedUserId')) {
// someAttribute is changed
this.getModelFactory().create('User', function (model1) {
model1.id =model.get('assignedUserId');
model1.fetch().then(function () {
debugger;
var teamsNames = model1.get('teamsNames');
Names = Object.values(teamsNames);
model.set('teamsNames',Names);
model.set('teamsIds',model1.get('teamsIds'));
console.log(model1); // it's fetched
}.bind(this));
});
I what to set entity teams by user teams
I try to set teamsNames and teamsIds, only teamsNames and so on.
The result in attach
full code (last version):
this.listenTo(this.model, 'change', (model, options) => {
debugger;
if (this.model.hasChanged('assignedUserId')) {
// someAttribute is changed
this.getModelFactory().create('User', function (model1) {
model1.id =model.get('assignedUserId');
model1.fetch().then(function () {
debugger;
var teamsNames = model1.get('teamsNames');
Names = Object.values(teamsNames);
model.set('teamsNames',Names);
model.set('teamsIds',model1.get('teamsIds'));
console.log(model1); // it's fetched
}.bind(this));
});
Comment