Skip to content

Commit c7d5b66

Browse files
Update README.md
1 parent f7bfd5c commit c7d5b66

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -65,42 +65,43 @@ Enter WHERE clause | :x: | String | provide aditional filters | Example `LastNam
6565

6666
### Call apex or javascript method
6767
For a button that is going to call callApexFromButton, the properties must be :
68-
- callApexFromButton: true
68+
- `callApexFromButton: true`
6969

7070
### Fire event to parent component
7171
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`
7474

7575
### Example
7676
Javascript array (actionButtonsList property) :
77-
```
77+
```yml
7878
[
7979
{ label : "delete all", variant: "destructive", needSelectedRows: true, callApex: true },
8080
{ label : "action button", variant : "brand", needSelectedRows: false, callApex: false },
8181
{ label : "another action button", variant : "brand", needSelectedRows: true, callApex: false }
8282
];
8383
```
8484
Parent component (**you don't need parent component, you can define default buttons using actionButtonsList**) :
85-
```
86-
//in template
85+
```html
86+
<!-- in template -->
8787
<c-lwc-related-list object-name="Contact"
8888
columns={columns}
8989
related-field-api="AccountId"
9090
is-counter-displayed=true
9191
action-buttons-list={actions}
9292
show-checkboxes=true
9393
onaction2={helloWorld}
94-
onaction3={helloWorld}
95-
94+
onaction3={helloWorld}/>
95+
```
96+
```JS
9697
//in js controller
9798
helloWorld(event) {
9899
console.log('hello world');
99100
console.log('event rows ', event.detail);
100101
}
101102
```
102103

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
104105
implement the desired javascript/apex call based on the button label.
105106
- The button "action button" fires the event action2
106107
- The button "another action button" fires the event action3

0 commit comments

Comments
 (0)