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
jaelee125jaelee125 

Use custom component in LWC Datatable edit template

I'm currently trying to create a custom data type for LWC datatable that is editable. I'm trying to use the edit template but there seems to be hard requirement that the edit template has to include an input element with data-inputable. Documentation: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.data_table_custom_types_editable

Is there any way I can use custom lwc components in the edit template instead of an input element? (I've tried this but I keep getting an error: Editable custom types must define an editTemplate that includes an element with attribute data-inputable set to "true"')

It seems like this is not possible. Is there any way I can run custom logic on the edit template for a custom data type for lwc lightningn datatable? 

Gian Piere VallejosGian Piere Vallejos

You can edit the Edit Template by using the super() keyword in the constructor of the class that extends LightningDatatable.

This information can help you:

- https://techdicer.com/lookup-field-in-lwc-datatable-inline-edit/ (https://techdicer.com/lookup-field-in-lwc-datatable-inline-edit/" target="_blank)

https://github.com/jangidyogi94/SFDC-Recipes/tree/Lookup-in-Lightning-Datatable

I've recently faced a custom type requirement for a datatable that has another datatable as a child and it's very frustrating but we solved it. If you need more help, you can contact me on my LinkedIn (https://www.linkedin.com/in/gianvallejos/" target="_blank) profile.