function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ramya BalakrishnanRamya Balakrishnan 

trying to create lightning data table component in Visual studio code

Hi all

The following error is showing while trying to create lightning data table component in Visual studio code. Please suggest how to resolve this. Thanks.
<template>
    <h1 style="height: 30px;font-size:14px;background-color:#F4F4F4;padding-left:10px; text-align:left;font-weight: bold;">
        Sales(Year over Year)
    </h1>
 <div style="height: 300px;">

      <lightning-datatable
                key-field="id"
                data={data}
                show-row-number-column
                row-number-offset={rowOffset}
                suppress-bottom-bar
                columns={columns}>
        </lightning-datatable>
    </div>
</template>

User-added image
AnkaiahAnkaiah (Salesforce Developers) 
Hi Ramya,

Refer the below link have an example how to created LWC data table.
https://www.sfdcpoint.com/salesforce/lightning-web-component-lightning-datatable/

If this helps, Please mark it as best answer.

Thanks!!
Ramya BalakrishnanRamya Balakrishnan
I have referred this link. But the error I am getting is that data table is not supported in mobile device. I don't  need to use that data table in mobile. How to avoid this error?
mukesh guptamukesh gupta
Hi Ramya,

Please try with
<lightning-datatable class="slds-max-medium-table_stacked" >
https://developer.salesforce.com/docs/component-library/bundle/lightning-datatable/documentation

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh