Skip to main content

Datatable

Mikhail Prisheltsev
Mikhail Prisheltsev

Datatable with picklist/compound/changable type cells​

Extention for LWC Datatable with custom columns able to:

  • edit Picklist fields;
  • show compound data (Label + Input field) in one cell;
  • switch between URL or label cell type dependent on parameters.

Two Datatable wrapper components, which:

  • handles Edit functionality and states;

example

  • handles Pagination functionality.

example

Usage​

  1. Use lwc-datatable as a starting point
  2. Assemble columns array
  3. Set datatable columns, data properties
  4. Move to picklistDatatable / editableDatatable / editablePaginatedDatatable
  5. To build custom column use buildPicklistColumn / buildLabeledInputColumn / buildUrlWithValueColumn functions imported from c/constants:

Custom columns description​

Picklist column​

Opens lightning-combobox when is edited.

example

Compound column​

Combines values of two fields to display in the cell. Shows lightning-input for one of the fields.

example

Label/URL column​

Displays text value of the one field and makes it an URL if the URL is provided from the second field.

example

Examples​

Look into sampleTable component as a referrence. It has all three datatables with all three custom column types.

example

Base datatable with custom cells​

example

Datatable with edit/restore wrappers​

example

Datatable with pagination and edit wrappers​

example