on change firing when page is loading

Hi All

     I need to trigger an event on change in record view

I have used

({

     extendsFrom: 'RecordView',

    initialize: function(options) {

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

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

    }, 

     _updateSubject: function(model) 

     {    alert("checking is chekcing");

          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 same code works perfectly for create actions but not for recordview.Can any one please help.

Parents
  • Hi sidhu,

    You can do trick in that , like checking save button is enabled or not

    if($('[name="save_button"]').is(":visible")){
        console.log("save button is enabled");
        //here you can add your functionality
    }
    

    For your condition you can above code in your _updateSubject function.

    Hope this helps!.

Reply
  • Hi sidhu,

    You can do trick in that , like checking save button is enabled or not

    if($('[name="save_button"]').is(":visible")){
        console.log("save button is enabled");
        //here you can add your functionality
    }
    

    For your condition you can above code in your _updateSubject function.

    Hope this helps!.

Children
No Data