Announcement

Collapse
No announcement yet.

Front-End custom row-actions in relationshipPanel

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

  • Front-End custom row-actions in relationshipPanel

    Hi,

    really don't understand ES6. .i hope front end specialist can post "how-to"

    contact.json :

    PHP Code:
            "contactInsurances": {
                
    "rowActionsView""custom:views/record/row-actions/relationship-edit-and-remove-and-print",
                
    "select"false,
                
    "create"true,
                
    "layout""listInsurancesForContact"
            
    },​ 
    custom:views/record/row-actions/relationship-edit-and-remove-and-print.js

    PHP Code:
    import RelationshipActionsView from 'views/record/row-actions/relationship';

    class 
    RelationshipEditAndRemoveAndPrintActionsView extends RelationshipActionsView {

        
    getActionList() {
            const list = [];

            if (
    this.options.acl.edit) {
                list.
    push({
                    
    action'quickEdit',
                    
    label'Edit',
                    
    data: {
                        
    idthis.model.id,
                    },
                });
            }

            if (
    this.options.acl.delete) {
                list.
    push({
                    
    action'quickRemove',
                    
    label'Remove',
                    
    data: {
                        
    idthis.model.id,
                    },
                });
            }

            if (
    this.options.acl.delete) {
                list.
    push({
                    
    action'quickPrint',
                    
    label'Print',
                    
    data: {
                        
    idthis.model.id,
                    },
                });
            }

            return list;
        }
    }

    export default RelationshipEditAndRemoveAndPrintActionsView;​ 
    result : can't import outside module.

    I have just added "print Action".

    Any help ?
    or transform this to "non ES6"

  • #2
    You can't use ES6 modules w/o doing transpiling/transforming. Transpiling is only supported for espo modules (ext-template has the necessary tool).

    Comment


    • #3
      In the current implementation, ES6 modules are actually transpiled to AMD modules so they can be executed by the browser.

      Unless you are interested in having modules that can be exported like Node.js modules, or be able to utilize static analysis and other professional software development tools, I would just implement your code customization using standard AMD syntax.

      From the user (your customer) point of view, it will not make any difference.

      Comment


      • #4
        The main benefit of using ES6 modules is IDE support. It's just way easier to write code.

        ES6 running on production unlikely to ever happen. This is the reality of the web.

        Comment

        Working...
        X