@@ -65,42 +65,43 @@ Enter WHERE clause | :x: | String | provide aditional filters | Example `LastNam
65
65
66
66
### Call apex or javascript method
67
67
For a button that is going to call callApexFromButton, the properties must be :
68
- - callApexFromButton: true
68
+ - ` callApexFromButton: true `
69
69
70
70
### Fire event to parent component
71
71
For a button that is going to fire an event, the properties must be :
72
- - callApex: false
73
- - needSelectedRows : can be true if you need to send selected rows to parent component
72
+ - ` callApex: false `
73
+ - ` needSelectedRows : can be true if you need to send selected rows to parent component `
74
74
75
75
### Example
76
76
Javascript array (actionButtonsList property) :
77
- ```
77
+ ``` yml
78
78
[
79
79
{ label : "delete all", variant: "destructive", needSelectedRows: true, callApex: true },
80
80
{ label : "action button", variant : "brand", needSelectedRows: false, callApex: false },
81
81
{ label : "another action button", variant : "brand", needSelectedRows: true, callApex: false }
82
82
];
83
83
```
84
84
Parent component (** you don't need parent component, you can define default buttons using actionButtonsList** ) :
85
- ```
86
- // in template
85
+ ``` html
86
+ <!-- in template -->
87
87
<c-lwc-related-list object-name =" Contact"
88
88
columns ={columns}
89
89
related-field-api =" AccountId"
90
90
is-counter-displayed =true
91
91
action-buttons-list ={actions}
92
92
show-checkboxes =true
93
93
onaction2 ={helloWorld}
94
- onaction3={helloWorld}
95
-
94
+ onaction3 ={helloWorld}/ >
95
+ ```
96
+ ``` JS
96
97
// in js controller
97
98
helloWorld (event ) {
98
99
console .log (' hello world' );
99
100
console .log (' event rows ' , event .detail );
100
101
}
101
102
```
102
103
103
- - The first button "delete all" is not going to send event to parent it will call the javascript method callApexFromButton you must
104
+ - The first button "delete all" is not going to send event to parent it will call the javascript method ` callApexFromButton ` you must
104
105
implement the desired javascript/apex call based on the button label.
105
106
- The button "action button" fires the event action2
106
107
- The button "another action button" fires the event action3
0 commit comments