-
Notifications
You must be signed in to change notification settings - Fork 93
soqlDatatable: Custom Column Type Attributes
Important Note: I haven't decided how to handle the failure mode(s) yet, so if your column config property is incorrect - the table won't load. In the interim, please inspect browser console for any errors.
Using the Column Configuration
app builder property, you can point to a
Datatable_Config__mdt
DeveloperName that has a defined
Datatable_Column_Config__mdt
child / children.
Each entry into Datatable_Column_Config__mdt
would target a single
column, for the soqlDatatable
pointing to the Datatable_Config__mdt
string.
Configure it in a similar fashion as either Action
or Lookup
configs.
Here is a sample of the Column Config section on the layout:
Given the following SOQL:
SELECT Name, Email, Phone, LeadSource, AccountId, Account.Type FROM Contact LIMIT 50
Here is how to set the Email
field to a large initialWidth
:
-
Column Field Name:
Email
-
Column Properties JSON:
{ "initialWidth": 500 }
Another example, given the following SOQL:
SELECT Name, Amount FROM Opportunity LIMIT 50
Here is how to configure the Amount
field (assuming it is set up as 14, 4 for
more decimals) for 4 decimal place inline-edit:
-
Column Field Name:
Amount
-
Column Properties JSON:
{ "typeAttributes": { "currencyCode": { "fieldName": "CurrencyIsoCode" }, "minimumFractionDigits": 4, "step": 0.0001 }, "initialWidth": 100 }
Note here that currencyCode
is referencing another column entirely, the
output of the fieldName
of CurrencyIsoCode
. This example would allow you
to have different currency symbols per row, since the column definition is
looking at what the currency code is for that row.
For more info on how to use column properties, please see the official docs.