How to call js function on record view of custom field

How to call js function on record view of custom field

Screenshot from 2016-04-13 19:54:26.png

Parents
  • You can add some events in record.js or recordlist.js like:

    ({

      extendsFrom: 'RecordlistView',  // or RecordView

      initialize: function (options) {

      this._super("initialize", arguments);

      this.events = _.extend({}, this.events, {

      'click [name="some_button_name_of_fieldname"]':'SomeFunction'

      });

      this.context.on('list:some_button_name_of_fieldname:fire', this.SomeFunction, this);

      }

      // ...

    })

  • Hello Mehul Bhandari,

    I hope you doing well.

    Please put below code in your record.js and check. This code is work for me.

       ({
        extendsFrom: 'RecordView',
        initialize: function (options) {
            this._super('initialize', [options]);
           this.model.on('change:rating_c', this._disableEditForUserType, this);
        },
        _disableEditForUserType: function () {
            console.log("It's Working");
        }
    })
    

    Hope it will help.

    Let me know for more help.

    -BPATEL

Reply
  • Hello Mehul Bhandari,

    I hope you doing well.

    Please put below code in your record.js and check. This code is work for me.

       ({
        extendsFrom: 'RecordView',
        initialize: function (options) {
            this._super('initialize', [options]);
           this.model.on('change:rating_c', this._disableEditForUserType, this);
        },
        _disableEditForUserType: function () {
            console.log("It's Working");
        }
    })
    

    Hope it will help.

    Let me know for more help.

    -BPATEL

Children
No Data