Trying to understand the client-side code although I'm not experienced with backbonejs. I'm trying to use the createview function for added fields such as, 'hourlyRate' in the matters entity, and 'tot-hours' in the task entity. Wondering if I'm in the ballpark as far my code below being correct and able to use in the setup function?
Code:
Espo.define('Advanced: Views.QuoteItem.Fields.HourlyRate', 'Views.Fields.Currency', function (Dep) {
return Dep.extend({
detailTemplated: 'fields.float.edit',
fetch: function(){
var value = this.$element.val();
value = this.parse(value);
var data = {};
data[this.name] = value;
return data;
}
});
});
Code:
this.createView('hourlyRate','Advanced: QuoteItem.Fields.HourlyRate'){
model: this.model,
defs: {
name: 'hourlyRate'
},
mode: this.mode,
el: this.options.el + ' .field-hourlyrate',
inlineEditDisabled: true
}, function (view) {
this.listenTo(view,'change',function () {
setTimeout(function () {
this.trigger('change');
}.bind(this),50);
}, this);
}.bind(this));
}
Code:
Espo.define('Advanced:Views.QuoteItem.Fields.TotHours','Views.Fields.Float', function (Dep) {
return Dep.extend({
detailTemplated: 'fields.float.edit',
fetch: function() {
var value = this.$element.value();
value = this.parse(value);
var data = {};
data[this.name] = value;
return data;
});
});
Code:
Espo.define('Advanced:QuoteItem.Fields.TotHours',function (Dep) {
this.createView('tot_hours','Advanced:QuoteItem.Fields.TotHours'){
model: this.model,
defs: {
name:'tot_hours'
},
mode: this.mode,
el: this.options.el + '.field-tot_hours',
inlineEditDisabled: true
}, function (view) {
this.listenTo(view,'change',function() {
setTimeout(function () {
this.trigger('change');
}.bind(this),50);
},this);
}.bind(this));
});

Comment