Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOQL Datatable - For picklist, display the label instead of the API Name #41

Closed
Esya opened this issue Nov 20, 2020 · 2 comments · Fixed by #43
Closed

SOQL Datatable - For picklist, display the label instead of the API Name #41

Esya opened this issue Nov 20, 2020 · 2 comments · Fixed by #43
Assignees
Labels
bug Something isn't working

Comments

@Esya
Copy link
Contributor

Esya commented Nov 20, 2020

Currenty, when a picklist field is displayed in a Datatable, it displays the API Name instead of the Value/Label.

This one

In the example above, it displays 60 instead of 60 min (But it does display 60 min in the picker)

@tsalb
Copy link
Owner

tsalb commented Nov 23, 2020

This is probably some oversight on my part - it makes sense to do it the way you mentioned here.

I'd have to investigate if I have a map (value:apiName) somewhere to reference during the final save to server (or save to collection datatable array).

If not, the LOE is slightly higher but should be fixed.

@tsalb tsalb self-assigned this Nov 23, 2020
@tsalb tsalb added the bug Something isn't working label Nov 23, 2020
@tsalb
Copy link
Owner

tsalb commented Dec 7, 2020

Investigating this one now, here's a quick update:

The value of the cell is now held until the label can be derived from the getPicklistValues wire adapter, I check the delta and then assign the displayValue for you. However, this is causing some UX issues:

  • The load of the cell LWC is faster than the load of the getPicklistValues wire adapter, resulting in the datatable thinking there is no value - and thus - shrinking its horizontal width (auto columns width is detrimental here).
  • Then, the value gets loaded in, but the column width is still still shrunk (truncates the value).

The alternative here is (open to suggestions!):

  • Load the SOQL-ed picklist value in the picklist cell first (same as current state).
  • Add secondary function which runs only to change the display label if it is different than value.
  • Does not resize the columns after (so if your label is much longer than your value, you have to deal with it yourself)
    • Rationale here is I don't want to introduce additional "screen judder" by manipulating the column widths after initial paint (which is driven, partially, by the length of the picklist value).

I'll stash changes I have now and work on a patch that reflects the alternative listed here, it should provide a "good enough" UX.

tsalb added a commit that referenced this issue Dec 8, 2020
Additionally, this unifies some of the events between custom picklist and custom lookup
@tsalb tsalb mentioned this issue Dec 8, 2020
@tsalb tsalb closed this as completed in #43 Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants