Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public class OD_DatatableRecordsControllerTest {
true,
'Contact',
'FirstName,LastName',
'[{"LastName": "Created 1"},{"LastName": "Created 2"}]',
'[{"LastName": "Created 1", "FirstName": "Test 1"},{"LastName": "Created 2", "FirstName": "Test 2"}]',
'[{ "Id": "' + contacts[0].Id + '", "LastName": "LastName Updated"}]',
'[{ "Id": "' + contacts[1].Id + '"}]',
false
Expand Down Expand Up @@ -199,7 +199,7 @@ public class OD_DatatableRecordsControllerTest {
true,
null,
'FirstName,LastName',
'[{"LastName": "Created 1"},{"LastName": "Created 2"}]',
'[{"LastName": "Created 1", "FirstName": "Test 1"},{"LastName": "Created 2", "FirstName": "Test 2"}]',
'[{ "Id": "' + contacts[0].Id + '", "LastName": "LastName Updated"}]',
'[{ "Id": "' + contacts[1].Id + '"}]',
false
Expand Down Expand Up @@ -543,7 +543,7 @@ public class OD_DatatableRecordsControllerTest {
false,
'Contact',
'FirstName,LastName',
'[{"LastName": "Created 1"},{"LastName": "Created 2"}]',
'[{"LastName": "Created 1", "FirstName": "Test 1"},{"LastName": "Created 2", "FirstName": "Test 2"}]',
'[{ "Id": "' + contacts[0].Id + '", "LastName": "LastName Updated"}]',
'[{ "Id": "' + contacts[1].Id + '"}]',
false
Expand Down Expand Up @@ -571,7 +571,7 @@ public class OD_DatatableRecordsControllerTest {
false,
null,
'FirstName,LastName',
'[{"LastName": "Created 1"},{"LastName": "Created 2"}]',
'[{"LastName": "Created 1", "FirstName": "Test 1"},{"LastName": "Created 2", "FirstName": "Test 2"}]',
'[{ "Id": "' + contacts[0].Id + '", "LastName": "LastName Updated"}]',
'[{ "Id": "' + contacts[1].Id + '"}]',
false
Expand Down Expand Up @@ -761,4 +761,4 @@ public class OD_DatatableRecordsControllerTest {

Test.stopTest();
}
}
}
2 changes: 1 addition & 1 deletion force-app/main/default/lwc/odDatatable/odDatatable.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</template>

<!-- Table or no records message -->
<template lwc:if={tableData.length}>
<template lwc:if={displayTableData}>
<c-od-datatable-custom
key-field="_id"
class="od-datatable"
Expand Down
6 changes: 6 additions & 0 deletions force-app/main/default/lwc/odDatatable/odDatatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default class ODDatatable extends LightningElement {
@api objectName;
@api columns;
@api noRecordsMessage;
@api displayNoRecordsMessage;
@api showRowNumberColumn;

// sharing
Expand Down Expand Up @@ -598,6 +599,11 @@ export default class ODDatatable extends LightningElement {
return result;
}

@api
get displayTableData() {
return (!this.displayNoRecordsMessage.value || this._tableData?.length);
}

get isFirstPage() {
return this.currentPage === 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
name="tableData"
label="Data Source Record Collection"
type="{T[]}"
role="inputOnly"
description="Record Collection variable containing the records to display in the datatable. This is mutated by add/edit/delete"
/>
<property
Expand All @@ -39,6 +40,14 @@
role="inputOnly"
default="No Records Found"
description="Message to display instead of the datatable if there are no records."
/>
<property
name="displayNoRecordsMessage"
label="Show No Records Message"
type="String"
role="inputOnly"
default="Yes"
description="Display No Record Message instead of the datatable if there are no records."
/>
<property
name="canAdd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ <h1 class="slds-text-color_inverse slds-text-heading_medium slds-p-around--small
help-text={inputValues.noRecordsMessage.helpText}
>
</c-od-datatable-input-generic>
<c-od-datatable-input-generic
field-name="displayNoRecordsMessage"
type={inputValues.displayNoRecordsMessage.type}
editable
toggle-value-active={yesNo.YES}
toggle-value-inactive={yesNo.NO}
class="slds-size--1-of-1"
value={inputValues.displayNoRecordsMessage.value}
label={inputValues.displayNoRecordsMessage.label}
onupdatefield={handleInputChange}
help-text={inputValues.displayNoRecordsMessage.helpText}
>
</c-od-datatable-input-generic>
<c-od-datatable-input-generic
field-name="showRowNumberColumn"
type={inputValues.showRowNumberColumn.type}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ export default class OdConfigurationEditor extends LightningElement {
value: 'No Records Found',
helpText: 'Message to display instead of the datatable if there are no records.',
},
displayNoRecordsMessage: {
label: 'Display No Records Message',
type: FIELD_TYPES.TOGGLE,
valueType: FIELD_TYPES.STRING,
value: YES_NO.YES,
helpText: 'Display No Records Message instead of the datatable if there are no records.',
},
canAdd: {
label: 'Can Add?',
type: FIELD_TYPES.TOGGLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
table-data={dummyData}
columns={configuration.columns.value}
no-records-message={configuration.noRecordsMessage.value}
display-no-records-message={configuration.displayNoRecordsMessage.value}
show-row-number-column={configuration.showRowNumberColumn.value}
is-master-detail={configuration.isMasterDetail.value}
master-detail-configuration={configuration.masterDetailConfiguration.value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
table-data={data}
columns={columns}
no-records-message={noRecordsMessage}
display-no-records-message={displayNoRecordsMessage}
show-row-number-column={showRowNumberColumn}
is-master-detail="Yes"
master-detail-configuration={masterDetailConfiguration}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ export default class OdDatatableRelatedList extends LightningElement {
return this._configuration.noRecordsMessage ? this._configuration.noRecordsMessage.value : '';
}

get displayNoRecordsMessage() {
return this._configuration.displayNoRecordsMessage ? this._configuration.displayNoRecordsMessage.value : YES_NO.YES;
}

get showRowNumberColumn() {
return this._configuration.showRowNumberColumn ? this._configuration.showRowNumberColumn.value : YES_NO.NO;
}
Expand Down