
Hi KMK91,
- As you mentioned you are able to hide the checkbox in the lwc data table.
- Please try the below code and take a reference.
Please mark it as Best Answer if the above information was helpful.Thanks.<template>
<lightning-datatable
key-field="id"
columns={columns}
data={lstRecords}
>
</lightning-datatable>
</template>
---------------------------------
import { LightningElement,wire } from 'lwc';
import getRecords from '@salesforce/apex/fetchAccount.getRecords';
export default class ShowSeperateRowColumn extends LightningElement {
columns = [{label : 'Row Number', fieldName : 'rowNumber',type : 'number'},
{label : 'Name', fieldName : 'Name',type : 'text'},
{label : 'Phone', fieldName : 'Phone',type : 'text'},
{label : 'Type', fieldName : 'type',type : 'text'}];
lstRecords;
@wire (getRecords)fetchData(value) {
const {
data,
error
} = value;
if (data) {
let result = JSON.parse(JSON.stringify(data));
console.log('result==> ' + JSON.stringify(result));
for(var i=0; i<result.length; i++){
result[i].rowNumber = i+1;
}
this.lstRecords = result;
}
else if(error){
console.log(error);
this.lstRecords = [];
}
}
}
---------------------------------------------------
public with sharing class fetchAccount {
@AuraEnabled(Cacheable=true)
public static List<Account> getRecords(){
return [SELECT Id,Name,Phone,type From Account];
}
}