Hello,
ServiceDescriptions data is loaded using ajax. This works fine.
But When I have more than 5-6 items in quote item list, the system becomes too slow to load, and it is the worst for more than 10 items.
Can anyone please help me to solve this problem.
Thanks.
Espo.define('Advanced:Views.QuoteItem.Fields.Servi ceDescriptions', 'Views.Fields.Enum', function (Dep) {
return Dep.extend({
translatedOptions: null,
setup: function () {
Dep.prototype.setup.call(this);
this.setupOptions();
this.listenTo(this.model, 'change', function (model) {
this.setupOptions();
this.render();
}, this);
},
setupOptions: function () {
if (this.mode != 'list') {
var url = 'Product/action/loadListItemField';
this.translatedOptions = null;
var list = [];
var id = this.model.get('productId');
$.ajax({
url: url,
data: {
id: id,
},
type: "GET",
dataType: 'json',
async: false,
}).done(function (respose) {
list.push("");
$.each(respose, function (i) {
var val = respose[i].description;
var listVal = val + "-" + respose[i].unit;
list.push(listVal);
});
this.wait(false);
}.bind(this));
this.params.options = list;
}
},
);
});
ServiceDescriptions data is loaded using ajax. This works fine.
But When I have more than 5-6 items in quote item list, the system becomes too slow to load, and it is the worst for more than 10 items.
Can anyone please help me to solve this problem.
Thanks.
Espo.define('Advanced:Views.QuoteItem.Fields.Servi ceDescriptions', 'Views.Fields.Enum', function (Dep) {
return Dep.extend({
translatedOptions: null,
setup: function () {
Dep.prototype.setup.call(this);
this.setupOptions();
this.listenTo(this.model, 'change', function (model) {
this.setupOptions();
this.render();
}, this);
},
setupOptions: function () {
if (this.mode != 'list') {
var url = 'Product/action/loadListItemField';
this.translatedOptions = null;
var list = [];
var id = this.model.get('productId');
$.ajax({
url: url,
data: {
id: id,
},
type: "GET",
dataType: 'json',
async: false,
}).done(function (respose) {
list.push("");
$.each(respose, function (i) {
var val = respose[i].description;
var listVal = val + "-" + respose[i].unit;
list.push(listVal);
});
this.wait(false);
}.bind(this));
this.params.options = list;
}
},
);
});
Comment