Skip to content

soqlDatatable: Inline Editing

James Hou edited this page Jan 24, 2021 · 1 revision

Define which fields can be editable in a comma separated list in the Editable Fields design attribute. For data types that are supported in the vanilla lightning-datatable, such as date, text, number, those are relied on as heavily as possible.

Note: All edits on save will be saved to database using Lightning Data Service updateRecords. Errors will be handled using lightning-datatable formatted error handling.

For data types such as picklist and lookup which are yet to be supported, this component provides custom data types as follows.

Picklist Custom Data Type

This custom data type is surfaced as customPicklist. It always places a --None-- value, regardless of if your picklist is configured to always require a value. The save will fail and user will need to correct it to move on.

RecordType restricted picklist values are supported with a limitation:

When using mass edit on a Picklist field for a Standard Object enabled with Record Types, it's possible to mass apply a value which does not belong on that table. This seems to be because Standard Object picklist fields do not have the Restrict picklist to the values defined in the value set option.

The actual picklist edit cell is a fork of the one authored by jlyon87 as found here

Lookup Custom Data Type

The custom LWC data type is surfaced as customLookup.

Each soqlDatatable can be have one defined Lookup Configuration (Datatable_Config__mdt) to define lookup search behavior.

Because of a limitation with cmdt, the Type__c on the parent Datatable_Config__mdt must be Lookups.

When using inline edit and lookup, there are two properties that are set as global defaults on Datatable_Lookup_Config__mdt that help with the search results:

  • Title: Name of the Record
  • Subtitle: null

However, in this sample repo, they are overridden by the following settings:

soql-datatable-lookup-defaults.png

Which produces this kind of search result:

The actual lookup edit cell is a fork of the one authored by jlyon87 as found here

Supported Features for all Custom Data Types

  • Multi-line inline edit (aka mass-edit).

  • Partial save across rows is supported.
    • Error display user experience is aligned to native list views.
    • If one row errors, all fields/columns for that row fail as well until all errors are resolved.

Limitations

  • Keyboard navigation.
    • Pending lwc / aura issue investigation here.
  • Geolocation fields must be queried with the __Longitude__s and __Latitude__s (capital L).
  • Time data type is not yet supported for view or edit.
Clone this wiki locally