Announcement

Collapse
No announcement yet.

On Change Event

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • On Change Event

    Hi,
    I have one enum field in quotes- currency
    I am trying to get that field's onchange event. Both alerts not working. What is missing in my code? Please help.
    Thanks.

    My code:

    Espo.define('Advanced:Views.Quote.Fields.Currency' , 'Views.Fields.Enum', function (Dep) {
    return Dep.extend({
    setup: function () {
    Dep.prototype.setup.call(this);
    this.events['click [data-action="selectProduct"]'] = this.actionSelectProduct;
    this.on('change', function () {
    alert('changed');
    }, this);
    },
    actionSelectProduct: function () {
    alert('actionSelectProduct');
    }
    });
    });

  • #2
    Hello
    http://backbonejs.org/#Events-listenTo
    client/src/views/fields/base.js

    Comment


    • #3
      Sorry, I couldn't understand the mistake in my code.


      Espo.define('Advanced:Views.Quote.Fields.Currency' , 'Views.Fields.Enum', function (Dep) {
      return Dep.extend({
      setup: function () {
      Dep.prototype.setup.call(this);

      this.listenTo(this.model, 'change:currency', function (model) {
      alert('ok');
      }, this);
      }
      });
      });


      Not working. Please help

      Comment


      • #4
        Code:
        setup: function () {
        Dep.prototype.setup.call(this); 
        console.log('loaded view');
        this.listenTo(this, 'change', function (model) {
        console.log('ok');
        }, this); 
        }

        Comment

        Working...
        X