How set readOnly dynamically in record.js?

I'm need set readOnly in custom field when logged user not admin in record.js

if(app.user.get('type') == 'admin')
  //set readOnly field
else
  //set editable fiel

Parents Reply
  • Hi,

    Try 

     this.$('.record-edit-link-wrapper[data-name=' + field.name + ']').remove();
    instead of
    self.noEditFields.push(field.name); As this will not work on 7.8.. versions.
    Also disable edit and save action.
    $('.headerpane a[name=edit_button]').addClass("disabled");
    $('.headerpane a[name=save_button]').addClass("disabled");
    var self = this;
    _.each(this.model.fields, function(field) {
        //self.noEditFields.push(field.name);
        this.$('.record-edit-link-wrapper[data-name=' + field.name + ']').remove();
    },this);

    Regards,

    Usman

Children