AnsweredAssumed Answered

save and cancel buttons functionality are not working after creating custom events in record js

Question asked by sidhu sidhu on Feb 10, 2016
Latest reply on Mar 9, 2016 by Arthur Chocholacek

Hi All

 

    I need to add an event  on clicking the save and the cancel button in record js.

 

I have used

({

     extendsFrom: 'RecordView',

    initialize: function(options) {

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

        this.model.on('change:source',this._updateSubject);

       //this.collection.on('change', this._updateSubject, this);

    }, 

     _render: function() {

        this._super('_render');

       

    },

    events: {

  //'change [name="relatedaccount_c"]': 'handleEditing',

        'click [name=save_button]': 'handleSave',

        'click [name=cancel_button]': 'handleCancel',

    },

    handleSave:function()

    {

  alert("inside the save ");

  $('.sidebar-content').html('');

 

  },

  handleCancel:function()

  {

  alert("inside the cancel ");

  $('.sidebar-content').html('');

 

 

  },

     _updateSubject: function(model) 

  {  

  

  if($('[name="save_button"]').is(":visible"))

  { 

  $('.sidebar-content').html(this.model.get('source'));

  } 

 

  if(!($('[name="save_button"]').is(":visible")))

  { 

  $('.sidebar-content').html();

  } 

  

  

  /*

   var casesBean = app.data.createBean('Cases', {'id': '74602b4a-c240-783e-4e25-56b9b274ab73'} );

   var request = casesBean.fetch();

   request.xhr.done(function ()

  {

  var htmlElement=casesBean.get('testhtmlfield_c')

  $('.sidebar-content').html(htmlElement);

  });*/

  },

})

 

the event is triggering but the default functinality of the save button and the cancel button are not triggering.Can any one please help me with this.Do we need to extend the already existing events.How can we do this

Outcomes