Is it possible to create lookup fields and picklists with custom data types now?

Documentation says:

Create your own data types if you want to implement a custom cell, such as a delete row button or an image, or even a custom number display.

Component difference page also says:

lightning-datatable supports custom data types in table cells.

Since a child component is needed for custom data types, can these inner components be a custom picklist component or a lookup component?

import LightningDatatable from 'lightning/datatable';

import deleteRow from './deleteRow.html';
export default class MyDatatable extends LightningDatatable {
   static customTypes = {
       deleteRowButton: {
           template: deleteRow,
           // Provide template data here if needed
           typeAttributes: ['attrA', 'attrB'],
      //more custom types here

Yes, absolutely. You can create your own custom component with any tags/content you want and render it in a table cell for that column.

Step 1 : create custom component
Step 2 : Create a new component which extends datatable
Step 3 : We can use the component (that extended datatable) where-ever we want

Full details here: How to use custom LWC lightning component in lightning-datatable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.