When working on a bug, I just noticed that lighting:input now supports two percentage formatters, where the older one
percent expects the user to know to enter e.g. 0.5 for 50%:
<lightning:input type="number" label="Percentage" formatter="percent" step="0.0001" />
and the newer (better) one
percent-fixed allows the user to enter 50 for 50%:
<lightning:input type="number" label="Percentage" formatter="percent-fixed" step="0.01" />
Thought I was on to a quick win here, but the edited value ends up displayed in a lightning:datatable and no such luck there with only
type: 'percent' supported (and no documented options in this area via
typeAttributes) resulting in e.g. 50% getting displayed as 5000%.
What is the best approach to deal with percentages using these two components?
(I've just added the truly ugly workaround of an additional property that I put the percentage value divided by 100 in. So two properties for one value - a recipe for bugs in the future... Hope there is a good reason that lightning:datatable doesn't allow a custom formatter to be wired in.)