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);

      }

      // ...

    })

  • Thanks All its working on RecordView .. and Same want to apply on Create ..

    i have create custom/modules/Mod_Name/clients/base/views/create/create.js

    ======  below code not working ..  what is wrong ..

    ({

         extendsFrom: 'CreateView',

        initialize: function(options) {

            this._super('initialize', [options]);

           this.model.on('change:lead_fields',this._updateLeads, this);

           this.model.on('change:template_module',this._updatetempmod, this);

        },

       

         _updateLeads: function(model)

         {

             

                 console.log("Lead Fields"); 

             desc = this.model.get("description");

             selectedval = this.model.get("lead_fields");

             setval = desc + ' ' + selectedval;

             this.model.set('description',setval);

             this.model.set('lead_fields',"");

             

        },

       

        _updatetempmod: function(model)

         {

          

                 console.log("Template Fields"); 

             this.model.set('description',"");

          

        },

    })

Reply Children