Announcement

Collapse
No announcement yet.

Custom record edit view not loaded

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom record edit view not loaded

    Hi there,

    I recently did a custom edit view for one of my custom entities.
    As I've read, the edit view is used for the creation of an entity and when you click the "Edit" button inside the detail view.
    Click image for larger version

Name:	image.png
Views:	185
Size:	26.8 KB
ID:	98440

    I added a
    Code:
    console.log("here");
    inside my
    Code:
    setup()
    function and it prints only when creating a new entity, not when I click on the "Edit" button inside the detail view.

    Am I missing something ?


    Documentation talking about that : https://docs.espocrm.com/development/custom-views/

    Regards,
    Firyo.​

  • #2
    I have just tried both record/detail and record/edit and it works for both below is an example for both for account entity, Please note for edit the console.log will be triggered once the Edit button is clicked:

    PHP Code:
    define('custom:views/account/record/detail',
        [
    'views/record/detail'], function (Dep) {

            return 
    Dep.extend({

                
    setup: function(){
                    
    Dep.prototype.setup.call(this);
                    
    console.log("Editing in record/detail here");
                },
            });
    });
    ​ 
    PHP Code:
    define('custom:views/account/record/edit',
        [
    'views/record/edit'], function (Edit) {

            return 
    Edit.extend({

                
    setup: function(){
                    
    Edit.prototype.setup.call(this);
                    
    console.log("Editing record/edit here");
                },
            });
    });
    ​ 

    Comment


    • #3
      Originally posted by rabii View Post
      I have just tried both record/detail and record/edit and it works for both below is an example for both for account entity, Please note for edit the console.log will be triggered once the Edit button is clicked:

      PHP Code:
      define('custom:views/account/record/detail',
      [
      'views/record/detail'], function (Dep) {

      return 
      Dep.extend({

      setup: function(){
      Dep.prototype.setup.call(this);
      console.log("Editing in record/detail here");
      },
      });
      });
      ​ 
      PHP Code:
      define('custom:views/account/record/edit',
      [
      'views/record/edit'], function (Edit) {

      return 
      Edit.extend({

      setup: function(){
      Edit.prototype.setup.call(this);
      console.log("Editing record/edit here");
      },
      });
      });
      ​ 
      Hi rabii,

      First of all, thanks for your answer.

      I wanted to ask a question about the differences between 2 methods of editing an entity.

      Method 1 :
      Click image for larger version  Name:	image.png Views:	0 Size:	169.7 KB ID:	98478
      Click image for larger version  Name:	image.png Views:	0 Size:	113.4 KB ID:	98479

      Method 2 :
      Click image for larger version  Name:	image.png Views:	0 Size:	176.3 KB ID:	98480
      Click image for larger version  Name:	image.png Views:	0 Size:	157.9 KB ID:	98481
      Click image for larger version  Name:	image.png Views:	0 Size:	99.8 KB ID:	98482

      Because ​what I meant was the method 1.
      And my
      PHP Code:
      console.log("here"); 
      prints when creating a new entity and when I enter the full form in the method 2 (but it doesn't when I click the "Edit" button in the method 1).

      Regards,
      Firyo.
      Last edited by Firyo; 10-11-2023, 08:55 AM.

      Comment


      • #4
        Hey,

        The difference is each view will extend a view that has certain configuration and functions other than other views. The detail view is kind of parent as the edit view extend the detail and same for detailSmall and editSmall. i suggest that you go through the main views to understand how it works, tbh i am still learning too

        Comment


        • #5
          1. Edit mode on the detail view. The view is the same but fields are switched to edit mode. Different buttons displayed. URL #EntityType/view/{id}.
          2. Edit view. The same view when you create a record. URL #EntityType/edit/{id}.

          Comment


          • rabii
            rabii commented
            Editing a comment
            a question, i have been trying to use editModeDisabled on a custom record/detail but i am not sure i get it is purpose. as i understand on the record/detail custom view if i set thi editModeDisabled = true it should disable the button edit right ?

            /**
            * Disable edit mode. Can be overridden by an option parameter.
            *
            * @protected
            */
            editModeDisabled = false

            From the record/detail view class but i am not sure if that is its purpose. is this correct ?
        Working...
        X