Skip to content

Commit ef558e5

Browse files
committed
fix issues
1 parent 010daef commit ef558e5

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

main/default/classes/RelatedList.cls

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ public with sharing class RelatedList {
44
return Database.query(soql);
55
}
66

7-
@AuraEnabled(cacheable=true) public static Integer countRecords(String countSOQL) {
8-
if (String.isNotEmpty(countSOQL)) {
9-
return database.countQuery(countSOQL);
7+
@AuraEnabled(cacheable = true) public static Integer countRecords(String objectName) {
8+
if(String.isNotEmpty(objectName)) {
9+
return database.countQuery('SELECT count() FROM ' + objectName);
1010
}
1111
return 0;
12-
}
12+
}
1313
}
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
<template>
2-
<!-- Main content -->
3-
<lightning-card variant="Narrow" title={title} icon-name={iconName}>
4-
<lightning-button label="New" title="Non-primary action" onclick={newRecord} class="slds-m-left_x-small"
5-
slot="actions"></lightning-button>
6-
<!-- Error block -->
7-
<template if:true={error}>
8-
<div class="slds-notify slds-notify_alert slds-theme_alert-texture slds-theme_error" role="alert">
9-
<span class="slds-assistive-text">error</span>
10-
<p>{error}</p>
2+
<!-- Main content -->
3+
<lightning-card variant="Narrow" title={title} icon-name={iconName}>
4+
<lightning-button label="New" title="Non-primary action" onclick={newRecord} class="slds-m-left_x-small"
5+
slot="actions"></lightning-button>
6+
<!-- Error block -->
7+
<template if:true={error}>
8+
<div class="slds-notify slds-notify_alert slds-theme_alert-texture slds-theme_error" role="alert">
9+
<span class="slds-assistive-text">error</span>
10+
<p>{error}</p>
11+
</div>
12+
</template>
13+
<!-- Data table -->
14+
<template if:true={data}>
15+
<lightning-datatable key-field="id" data={data} columns={columns} onrowaction={handleRowAction}
16+
hide-checkbox-column>
17+
</lightning-datatable>
18+
</template>
19+
<!-- Pagination -->
20+
<div slot="footer" style="text-align: right;">
21+
<lightning-button variant="brand" disabled={isDisablePrev} label="First" title="Primary action"
22+
onclick={firstPage} class="slds-m-left_xx-small"></lightning-button>
23+
<lightning-button variant="brand" disabled={isDisablePrev} label="Previous" title="Primary action"
24+
onclick={previous} class="slds-m-left_xx-small"></lightning-button>
25+
<lightning-button variant="brand" disabled={isDisableNext} label="Next" title="Primary action" onclick={next}
26+
class="slds-m-left_xx-small"></lightning-button>
27+
<lightning-button variant="brand" disabled={isDisableNext} label="Last" title="Primary action"
28+
onclick={lastPage} class="slds-m-left_xx-small slds-m-right_xx-small"></lightning-button>
1129
</div>
12-
</template>
13-
<!-- Data table -->
14-
<template if:true={data}>
15-
<lightning-datatable key-field="id" data={data} columns={columns} onrowaction={handleRowAction}
16-
hide-checkbox-column>
17-
</lightning-datatable>
18-
</template>
19-
<!-- Pagination -->
20-
<div slot="footer" style="text-align: right;">
21-
<lightning-button variant="brand" disabled={isDisablePrev} label="First" title="Primary action"
22-
onclick={firstPage} class="slds-m-left_xx-small"></lightning-button>
23-
<lightning-button variant="brand" disabled={isDisablePrev} label="Previous" title="Primary action"
24-
onclick={previous} class="slds-m-left_xx-small"></lightning-button>
25-
<lightning-button variant="brand" disabled={isDisableNext} label="Next" title="Primary action" onclick={next}
26-
class="slds-m-left_xx-small"></lightning-button>
27-
<lightning-button variant="brand" disabled={isDisableNext} label="Last" title="Primary action"
28-
onclick={lastPage} class="slds-m-left_xx-small slds-m-right_xx-small"></lightning-button>
29-
</div>
30-
</lightning-card>
30+
</lightning-card>
3131
</template>

main/default/lwc/lwcRelatedList/lwcRelatedList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default class LightningDatatable extends NavigationMixin(
4646
});
4747
this.columns = cols;
4848
this.buildSOQL();
49-
countRecords({ countSOQL: this.buildCountSOQL() }).then((result) => {
49+
countRecords({ objectName: this.objectName }).then((result) => {
5050
this.totalRows = result;
5151
});
5252
this.fetchRecords();
@@ -251,4 +251,4 @@ export default class LightningDatatable extends NavigationMixin(
251251
})
252252
);
253253
}
254-
}
254+
}

0 commit comments

Comments
 (0)