Hi, this is useful info and session. Thanks for sharing info. When I try to run the Data table flow, automatically enabled the first 3 records while I was selected "Row Selection Mode"
Did you create any vedio where user manually input the any column value in the table like if there is selection of product and you want to end user that enter the quantity for the same
Hi Abhay! You need to make sure that the 'fieldName' in the columns definition matches the key names in your data objects. Also,make sure that the data you receive from the external service is in the format expected by the Data Table component. Generally, the Data Table in LWC expects an array of objects, where each object represents a row in the table, and each key-value pair represents a column in the table. Here is an example : export default class DataTableComponent extends LightningElement { @track data = []; connectedCallback() { // Make the callout to the external service fetch('api.example.com/data') // Replace with your actual API endpoint .then(response => response.json()) .then(data => { // Once you get the data, assign it to the "data" property this.data = data; }) .catch(error => { console.error('Error fetching data:', error); }); } } And define the columns as this : const COLUMNS = [ { label: 'Name', fieldName: 'Name', type: 'text' }, { label: 'Age', fieldName: 'Age__c', type: 'number' }, { label: 'Email', fieldName: 'Email__c', type: 'email' } // Add more columns as needed based on your data ]; export default class DataTableComponent extends LightningElement { columns = COLUMNS; // ... } Hope this helps!
Hi Rahil, you have to use onrowselection attribute on datatable and finding the record from your raw table data and push it to your event.detail.selectedRows to include it back in the selected rows.
Hi, this is useful info and session. Thanks for sharing info. When I try to run the Data table flow, automatically enabled the first 3 records while I was selected "Row Selection Mode"
Did you create any vedio where user manually input the any column value in the table like if there is selection of product and you want to end user that enter the quantity for the same
How can we display the response data coming from the external service in the form of Data Table?
Hi Abhay! You need to make sure that the 'fieldName' in the columns definition matches the key names in your data objects. Also,make sure that the data you receive from the external service is in the format expected by the Data Table component. Generally, the Data Table in LWC expects an array of objects, where each object represents a row in the table, and each key-value pair represents a column in the table. Here is an example :
export default class DataTableComponent extends LightningElement {
@track data = [];
connectedCallback() {
// Make the callout to the external service
fetch('api.example.com/data') // Replace with your actual API endpoint
.then(response => response.json())
.then(data => {
// Once you get the data, assign it to the "data" property
this.data = data;
})
.catch(error => {
console.error('Error fetching data:', error);
});
}
}
And define the columns as this :
const COLUMNS = [
{ label: 'Name', fieldName: 'Name', type: 'text' },
{ label: 'Age', fieldName: 'Age__c', type: 'number' },
{ label: 'Email', fieldName: 'Email__c', type: 'email' }
// Add more columns as needed based on your data
];
export default class DataTableComponent extends LightningElement {
columns = COLUMNS;
// ...
}
Hope this helps!
but how we can move selected row to next screen ?
Hi Rahil, you have to use onrowselection attribute on datatable and finding the record from your raw table data and push it to your event.detail.selectedRows to include it back in the selected rows.