|
1 | 1 | <template> |
2 | 2 | <!-- Main content --> |
3 | 3 | <lightning-card variant="Narrow" title={titleFormatted} icon-name={iconName}> |
4 | | - <lightning-button label="New" title="Non-primary action" onclick={newRecord} class="slds-m-left_x-small" |
| 4 | + <!--default button create --> |
| 5 | + <template if:false={actionButtonsListNotEmpty}> |
| 6 | + <lightning-button label="New" title="Non-primary action" onclick={newRecord} class="slds-m-left_x-small" |
5 | 7 | slot="actions"></lightning-button> |
| 8 | + </template> |
| 9 | + |
| 10 | + <!-- custom buttons for list --> |
| 11 | + <template if:true={actionButtonsListNotEmpty}> |
| 12 | + <template for:each={actionButtonsList} for:item="actionButton" for:index="index"> |
| 13 | + <lightning-button if:true={actionButton.callApex} |
| 14 | + key={actionButton.label} |
| 15 | + label={actionButton.label} |
| 16 | + title={actionButton.label} |
| 17 | + variant={actionButton.variant} |
| 18 | + onclick={callApexFromButton} |
| 19 | + class="slds-m-left_x-small" |
| 20 | + slot="actions" |
| 21 | + > |
| 22 | + </lightning-button> |
| 23 | + |
| 24 | + <lightning-button if:false={actionButton.callApex} |
| 25 | + data-index={index} |
| 26 | + key={actionButton.label} |
| 27 | + label={actionButton.label} |
| 28 | + title={actionButton.label} |
| 29 | + variant={actionButton.variant} |
| 30 | + onclick={fireEventFromButton} |
| 31 | + class="slds-m-left_x-small" |
| 32 | + slot="actions" |
| 33 | + > |
| 34 | + </lightning-button> |
| 35 | + |
| 36 | + </template> |
| 37 | + </template> |
| 38 | + |
6 | 39 | <!-- Error block --> |
7 | 40 | <template if:true={error}> |
8 | 41 | <div class="slds-notify slds-notify_alert slds-theme_alert-texture slds-theme_error" role="alert"> |
|
12 | 45 | </template> |
13 | 46 | <!-- Data table --> |
14 | 47 | <template if:true={data}> |
15 | | - <lightning-datatable key-field="id" data={data} columns={columns} onrowaction={handleRowAction} |
| 48 | + <!-- DATATALBE WITHOUT CHECKBOXES --> |
| 49 | + <lightning-datatable |
| 50 | + if:false={showCheckboxes} |
| 51 | + key-field="id" |
| 52 | + data={data} |
| 53 | + columns={columns} |
| 54 | + onrowaction={handleRowAction} |
16 | 55 | hide-checkbox-column> |
17 | 56 | </lightning-datatable> |
| 57 | + |
| 58 | + <!-- DATATABLE WITH CHECKBOXES --> |
| 59 | + <lightning-datatable |
| 60 | + if:true={showCheckboxes} |
| 61 | + key-field="id" |
| 62 | + data={data} |
| 63 | + columns={columns} |
| 64 | + onrowaction={handleRowSelection}> |
| 65 | + > |
| 66 | + </lightning-datatable> |
| 67 | + |
18 | 68 | </template> |
19 | 69 | <!-- Pagination --> |
20 | 70 | <div slot="footer" style="text-align: right;"> |
|
0 commit comments