2

I have extended the lightning-datatable in order to implement a working picklist editable datatable. I have created the template and the editTemplate as you can see below. The value is working fine in the template and outside the combobox in the editTemplate but not rendering in the combobox. What am I missing?

comboBox showing placeholder but not value. value showing below

Parent component referencing datatable

<c-cc_custom-lightning-datatable
   class="slds-scrollable projectDatatable"
   key-field="Id" 
   data={modalData.projectWork} 
   columns={modalData.projectColumns}
   onrowaction={handleRowAction}
   onsave={onSaveHandler}
   draft-values={draftValues}
   hide-checkbox-column
   ></c-cc_custom-lightning-datatable>

cc_customLightningDatatable.js

import LightningDatatable from 'lightning/datatable'
import customPicklist from './customPicklist.html'
import customPicklistEdit from './customPicklistEdit.html'

export default class Cc_customLightningDatatable extends LightningDatatable {
    static customTypes = {
        custom_picklist: {
            editTemplate: customPicklistEdit,
            template: customPicklist,
            standardCellLayout: true,
            typeAttributes: ['label', 'value','placeholder','options']
        }
    }
}

editTemplate

<template>
    <lightning-combobox
        name="picklist"
        label={typeAttributes.label}
        value={typeAttributes.value}
        placeholder={typeAttributes.placeholder}
        options={typeAttributes.options}
        variant="label-hidden"
        data-inputable="true"
    ></lightning-combobox>
    {typeAttributes.value}
</template>

template

<template>
    {typeAttributes.value}
</template>

1 Answers1

0

I'm also trying to do this.

You might get some ideas came from looking at this playground snippet from Lakshay Katney

While that sample only renders the picklist to the main template I almost have my editTemplate working.

I'd love to know how this comes out for you

bkwdesign
  • 1,953
  • 2
  • 28
  • 50