Announcement

Collapse
No announcement yet.

Extra button link

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

  • Extra button link

    Hi.

    I add extra button to Account Entity. I add this code to clientDef:

    "menu": {
    "detail": {
    "buttons": [
    {
    "label": "Zadzwoń",
    "action": "zadzwon",
    "acl": "read",
    "style": "default"
    }
    ]
    }
    },

    and button is ok.

    but….

    My question is how to make button to link: "tel: {name}" ?

  • #2
    You can't do this via clientDefs. You will need to create own class for detail view (Custom:Account.Detail) and add your button dynamically with "link": 'tel: ' + this.model.get('youField') instead of "action"

    Comment


    • #3
      Ok I have own class. I put detail.js in client/custom/src/views/account. My code:

      Code:
      Espo.define('Custom:Views.Account.Detail', 'Views.Detail', function (Dep) {
      
      return Dep.extend({
      
      relatedAttributeMap: {
      'contacts': {
      'billingAddressCity': 'addressCity',
      'billingAddressStreet': 'addressStreet',
      'billingAddressPostalCode': 'addressPostalCode',
      'billingAddressState': 'addressState',
      'billingAddressCountry': 'addressCountry',
      'id': 'accountId',
      'name': 'accountName'
      },
      },
      
      
      
      });
      });



      Can You give me a code ? I try with this but it doesn't work:

      Code:
      Espo.define('Custom:Views.Account.Detail', 'Views.Detail', function (Dep) {
      
      return Dep.extend({
      
      relatedAttributeMap: {
      'contacts': {
      'billingAddressCity': 'addressCity',
      'billingAddressStreet': 'addressStreet',
      'billingAddressPostalCode': 'addressPostalCode',
      'billingAddressState': 'addressState',
      'billingAddressCountry': 'addressCountry',
      'id': 'accountId',
      'name': 'accountName'
      },
      },
      
      this.menu.actions.push({
      'label': 'Zadzwoń',
      'link': 'tel: ' + this.model.get('name'),
      'acl': 'read'
      });
      
      });
      });

      Comment


      • #4
        You should put that code into setup method. Take some of existing classes as an expample.

        Comment


        • #5
          Ok thanx it's working.

          But tell me please how to make directly button instead of dropdown action?
          I guess that i need to change this.menu.actions.push ? But for what?
          And how open links in new card instead the same window?
          Last edited by homeempire; 07-10-2015, 12:11 PM.

          Comment


          • #6
            use this.menu.buttons

            Comment


            • #7
              Thanks. Working great. But how open links in new card?

              Comment


              • #8
                No ability. You will need to write action and js code.

                Comment

                Working...
                X