Announcement
Collapse
No announcement yet.
Dynamic logic not working
Collapse
X
-
Espo.define('Advanced:Views.QuoteItem.Fields.Quant ity', 'Views.Fields.integer', function (Dep) {
return Dep.extend({
setup: function () {
this.setReadOnly(true); ////////////////////////////////////////////// working
this.listenTo(this.model, 'change', function (model) {
if(model.get("productName")=="Afrobat Rider"){
this.setNotReadOnly(true);
}
}, this);
Dep.prototype.setup.call(this);
}
});
});
Not working.
Is this the way of doing that?
Please help.
Comment
-
Tried to do with addClass("hidden") in listener written in afterRender.
It hides the element but it comes back suddenly.
afterRender: function () {
this.listenTo(this.getView('name'), 'change', function () {
this.handleField();
}, this);
}
handleField:function () {
if (this.model.get('name') == "miscellaneous") {
this.$el.find('input[name="quantity"]').removeClass("hidden");
} else {
this.$el.find('input[name="quantity"]').addClass("hidden");
}
},
Don't understand whats wrong with this code.
Please help
Comment
Comment