return to list and edit attributes fix
This commit is contained in:
@@ -121,16 +121,19 @@ Espo.define('controllers/record', 'controller', function (Dep) {
|
||||
if (options.relate) {
|
||||
model.setRelate(options.relate);
|
||||
}
|
||||
if (options.attributes) {
|
||||
model.set(options.attributes)
|
||||
}
|
||||
|
||||
this.main(this.getViewName('edit'), {
|
||||
var o = {
|
||||
scope: this.name,
|
||||
model: model,
|
||||
returnUrl: options.returnUrl,
|
||||
views: this.getViews('edit'),
|
||||
});
|
||||
};
|
||||
|
||||
if (options.attributes) {
|
||||
this.model.set(options.attributes);
|
||||
}
|
||||
|
||||
this.main(this.getViewName('edit'), o);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -146,17 +149,18 @@ Espo.define('controllers/record', 'controller', function (Dep) {
|
||||
|
||||
this.showLoadingNotification();
|
||||
model.once('sync', function () {
|
||||
|
||||
if (options.attributes) {
|
||||
model.set(options.attributes)
|
||||
}
|
||||
|
||||
this.main(this.getViewName('edit'), {
|
||||
var o = {
|
||||
scope: this.name,
|
||||
model: model,
|
||||
returnUrl: options.returnUrl,
|
||||
views: this.getViews('edit'),
|
||||
});
|
||||
};
|
||||
|
||||
if (options.attributes) {
|
||||
o.attributes = options.attributes;
|
||||
}
|
||||
|
||||
this.main(this.getViewName('edit'), o);
|
||||
}, this);
|
||||
model.fetch({main: true});
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ Espo.define('views/detail', 'views/main', function (Dep) {
|
||||
|
||||
name: 'Detail',
|
||||
|
||||
optionsToPass: [],
|
||||
optionsToPass: ['attributes'],
|
||||
|
||||
views: {
|
||||
header: {
|
||||
|
||||
@@ -33,7 +33,7 @@ Espo.define('views/edit', 'views/main', function (Dep) {
|
||||
|
||||
menu: null,
|
||||
|
||||
optionsToPass: ['returnUrl'],
|
||||
optionsToPass: ['returnUrl', 'attributes'],
|
||||
|
||||
views: {
|
||||
header: {
|
||||
|
||||
@@ -131,6 +131,10 @@ Espo.define('Views.Record.Base', 'View', function (Dep) {
|
||||
|
||||
this.attributes = this.model.getClonedAttributes();
|
||||
|
||||
if (this.options.attributes) {
|
||||
this.model.set(this.options.attributes);
|
||||
}
|
||||
|
||||
this._initDependancy();
|
||||
},
|
||||
|
||||
|
||||
@@ -400,6 +400,10 @@ Espo.define('Views.Record.Detail', 'Views.Record.Base', function (Dep) {
|
||||
|
||||
this.attributes = this.model.getClonedAttributes();
|
||||
|
||||
if (this.options.attributes) {
|
||||
this.model.set(this.options.attributes);
|
||||
}
|
||||
|
||||
this.build();
|
||||
this.listenTo(this.model, 'sync', function () {
|
||||
this.attributes = this.model.getClonedAttributes();
|
||||
|
||||
Reference in New Issue
Block a user