Announcement

Collapse
No announcement yet.

How to move a related entity panel into the main panel list in detail view?

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

  • How to move a related entity panel into the main panel list in detail view?

    Hello. I am trying to move a related entity list (small) from the bottom panels into the main section, somewhere between the entity detail panels. Any idea how I can do this? Thanks!

  • #2
    Hello
    In Entity Manager set needed relation side as LinkMultiple Field and add this field to detail layout

    Comment


    • #3
      I've noticed Campaign has something similar, with the sticked Tracking URLs and Mass Emails, however I'd like to move the panels even higher up, in between the record panels.

      Comment


      • #4
        You can use campaign as example. Set own middleView for record/detail of your entity and override it

        Comment


        • #5
          I've managed to get the linkMultiple fields to work, but unfortunately they are not as functional as I'd need them, they only display the name and allow you to add and delete, not edit and no extra columns besides the name column. I've tried extending the view 'Views.Fields.LinkMultiple', my goal is to make a couple of fields editable: a file field and a date field. I've managed to display the date field's value, but I have no idea how to get the file to both display and be editable (ie upload a new file).

          I think it would be simpler to just somehow move the related entitity panel somehow within the panels.

          Unfortunately, I am using an older version of EspoCRM (2015-09-30).

          I haven't found "middleView" anywhere in the code.

          Comment


          • #6
            is there a way to simply push a panel in the top panels, similar to how crm:views/campaign/record/detail-bottom uses Array.unshift() to push a couple of objects? it seems panelList is not defined in views/record/detail, so I can't just transfer the code from detail-bottom to detail.

            Comment


            • #7
              I've managed to move the panels i wanted (two relationship panels) from detail-bottom to detail, by extending 'views/record/detail-bottom' and overriding setupRelationshipPanels() and afterRender(). My only remaining problem is that, while the 'add' button works, the per-record menu (view, edit, unlink and delete) don't work. They seem to not receive click events. Here is my afterRender:

              Code:
                              afterRender: function() {
                                      $('.cell-foo').closest('.panel').before($('.panel.panel-panel1').detach());
                                      $('.cell-foo').closest('.panel').before($('.panel.panel-panel2').detach());
                              },
              
                              setupRelationshipPanels: function () {
                                      var scope = this.scope;
              
                                      this.wait(true);
                                      this._helper.layoutManager.get(this.model.name, 'relationships', function (layout) {
                                              var panelList = layout;
                                              panelList.forEach(function (item) {
                                                      var p;
                                                      if (typeof item == 'string' || item instanceof String) {
                                                              p = {name: item};
                                                      } else {
                                                              p = item || {};
                                                      }
                                                      if (!p.name) {
                                                              return;
                                                      }
              
                                                      var name = p.name;
              
                                                      var links = (this.model.defs || {}).links || {};
                                                      if (!(name in links)) {
                                                              return;
                                                      }
              
                                                      var foreignScope = links[name].entity;
                                                      if (!this.getAcl().check(foreignScope, 'read')) {
                                                              return;
                                                      }
              
                                                      this.panelList.push(p);
              
                                                      var defs = this.getMetadata().get('clientDefs.' + scope + '.relationshipPanels.' + name) || {};
              
                                                      var viewName = defs.view || 'views/record/panels/relationship';
              
                                                      var viewEl = (name == 'panel1' || name == 'panel2' ? '#main > .body .record' : this.options.el) + ' .panel-body-' + Espo.Utils.toDom(p.name);
                                                      this.createView(name, viewName, {
                                                              model: this.model,
                                                              panelName: name,
                                                              defs: defs,
                                                              el: viewEl
                                                      }, function (view) {
                                                              if ('getActionList' in view) {
                                                                      p.actionList = this.filterActions(view.getActionList());
                                                              }
                                                              if ('getButtonList' in view) {
                                                                      p.buttonList = this.filterActions(view.getButtonList());
                                                              }
                                                              p.title = view.title;
                                                      }.bind(this));
                                              }.bind(this));
              
                                              this.wait(false);
                                      }.bind(this));

              Comment


              • #8
                Ok, I managed to fix those as well with this.getView().setElement()

                Comment

                Working...
                X