File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff 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 objectName ) {
8- if (String .isNotEmpty (objectName )) {
9- return database .countQuery (' SELECT count() FROM ' + objectName );
7+ @AuraEnabled(cacheable= true ) public static Integer countRecords (String countSOQL ) {
8+ if (String .isNotEmpty (countSOQL )) {
9+ return database .countQuery (countSOQL );
1010 }
1111 return 0 ;
12- }
12+ }
1313}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public with sharing class RelatedList_Test {
1717 User testUser = [Select id from user where id = :UserInfo .getUserId ()];
1818 Test .startTest ();
1919 System .runAs (testUser ){
20- RelatedList .countRecords (' Contact' );
20+ RelatedList .countRecords (' Select count() FROM Contact LIMIT 1 ' );
2121 RelatedList .countRecords (null );
2222 }
2323 Test .stopTest ();
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export default class LightningDatatable extends NavigationMixin(
4646 } ) ;
4747 this . columns = cols ;
4848 this . buildSOQL ( ) ;
49- countRecords ( { objectName : this . objectName } ) . then ( ( result ) => {
49+ countRecords ( { countSOQL : this . buildCountSOQL ( ) } ) . then ( ( result ) => {
5050 this . totalRows = result ;
5151 } ) ;
5252 this . fetchRecords ( ) ;
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
22<LightningComponentBundle xmlns =" http://soap.sforce.com/2006/04/metadata" >
3- <apiVersion >48 .0</apiVersion >
3+ <apiVersion >49 .0</apiVersion >
44 <isExposed >true</isExposed >
55 <targets >
66 <target >lightning__RecordPage</target >
1414 <property name =" columns" type =" String" required =" true" label =" Enter Columns JSON" />
1515 <property name =" relatedFieldAPI" type =" String" default =" " label =" Enter Related field API Name" />
1616 <property name =" whereClause" type =" String" default =" " label =" Enter WHERE clause" />
17+ <property name =" limit" type =" String" default =" 10" label =" Enter number of records to display on screen" />
1718 </targetConfig >
1819 </targetConfigs >
1920</LightningComponentBundle >
You can’t perform that action at this time.
0 commit comments