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

[Bug]-[300]:Default value is displayed on widget even when it is not available in drop-down options #12225

Closed
1 task done
Tracked by #11902
vivekverma2312 opened this issue Mar 24, 2022 · 15 comments
Closed
1 task done
Tracked by #11902
Assignees
Labels
Bug Something isn't working High This issue blocks a user from building or impacts a lot of users MultiSelect Widget Issues related to MultiSelect Widget MultiTree Select Widget Issues related to MultiTree Select Widget Production Select Widget Select or dropdown widget TreeSelect Issues related to TreeSelect Widget Verified When issue is retested post its fixed Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets

Comments

@vivekverma2312
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Description

Uploading Screenshot 2022-03-24 at 2.28.19 PM.png…

https://watch.screencastify.com/v/rTmvAKEDYT6lAqffXIXq

Steps To Reproduce

  1. Drag and drop a Select/multi-select/TreeSelect/Multi tree select
  2. Add any random value in Default Value
  3. Observe that it is shown in widget even when the default value is not present in drop-down options

Public Sample App

No response

Version

Cloud

@vivekverma2312 vivekverma2312 added Bug Something isn't working Select Widget Select or dropdown widget High This issue blocks a user from building or impacts a lot of users Production Needs Triaging Needs attention from maintainers to triage MultiSelect Widget Issues related to MultiSelect Widget MultiTree Select Widget Issues related to MultiTree Select Widget TreeSelect Issues related to TreeSelect Widget labels Mar 24, 2022
@github-actions github-actions bot added Widgets Product This label groups issues related to widgets UI Building Pod labels Mar 24, 2022
@Tooluloope
Copy link
Contributor

@dilippitchika Should we close this issue.
Since this was intended

@dilippitchika
Copy link
Contributor

dilippitchika commented Mar 30, 2022

@Tooluloope i think we should be smarter about this because it's causing frequent confusion.

Here's my suggestion on how to fix this -

  1. When user provides only value and not {label, value} in default, we check if the option exists. If it doesn't then we don't show this in default.
  2. When user provides {label, value} for default, we check if the option exists. If it doesn't then we NOW show this in default. This is the only way for a user to add default when they have configured the server side filtering in the widget.
    This is applicable both for select and multi-select widgets.

Let me know your thoughts

@Tooluloope
Copy link
Contributor

So Conclusion here was to enable this defaultValue caching only when Serverside Filtering is enabled. But once Serverside filtering is false, we do a strict check to know if the default value is in the list of options, and Only the default values in options would be displayed.

CC @dilippitchika @somangshu

@somangshu somangshu removed the Needs Triaging Needs attention from maintainers to triage label Apr 1, 2022
@dilippitchika
Copy link
Contributor

Stats

Stat Values
Reach 150
Effort (months) 1

@Nikhil-Nandagopal Nikhil-Nandagopal changed the title [Bug]: Default value is displayed on widget even when it is not available in drop-down options [Bug]-[300]:Default value is displayed on widget even when it is not available in drop-down options Apr 7, 2022
@somangshu
Copy link
Contributor

@techbhavin you can pick this up. @ashit-rath will be reviewing your code

@techbhavin
Copy link
Contributor

this issue is covered in PR#13079

@Tooluloope
Copy link
Contributor

QA Note

The following should be tested in the PR

  • For all the Select Family, The value must be strictly checked against the options except if serverside filtering is enabled, i.e all selectedValues/DefaultValues must exist in the options for it to be reflected in selectOptionValue
  • Connecting the defaultValue from a Table or external source, should reflect the expected value in selectOptionValue
  • Getting the expected value in a Form.
  • For Treeselect widgets, The Display Mode should reflect the right value

cc @ashit-rath @wmdev0808 @somangshu @dilippitchika

@dilippitchika
Copy link
Contributor

dilippitchika commented Apr 27, 2022

Adding my notes here for default value for testing- @Tooluloope @wmdev0808 @ashit-rath

Default value with server side filtering OFF- Select widget

  1. Supported formats - value, {label,value}
  2. When value is not present in the list of options
    • No default should be shown in the select widget
    • The default value field in property pane should show an error
      • Error message - "Default value is missing in options. Please update the value."
  3. When label is different between default {label,value} and in options
    • The label is shown from the list of options and NOT from the label added in the default field
      • The selectedOptionLabel and selectedOptionValue should populate data of value from default and label from options

Default value with server side filtering ON - Select widget

  1. Supported formats - value, {label, value}
  2. When value is present in list of options
    • Similar to server side filtering OFF; We show the default from the list of options
    • If label is not same between options and default {label, value}; We show the default from the list of options
      • The selectedOptionLabel and selectedOptionValue should populate data of value from default and label from options
  3. When value is not present in list of options
    • If the format is value and not {label,value}
      • No default should be shown in the select widget
      • The default value field in property pane should show an error
        • Error message - "Default value is missing in options. Please use {label : <string | num>, value : < string | num>} format to show default for server side data"
    • If the format is {label, value}
      • The default will be shown in the list of options using the label field from {label, value}
      • There should be no error in the default field
      • The selectedOptionLabel and selectedOptionValue should populate data from {label, value}

@ashit-rath
Copy link
Contributor

@dilippitchika Just double-checking, this is also true for multi-select?

@dilippitchika
Copy link
Contributor

@ashit-rath almost, but this is only for select. For multiselect, i will add more notes.

@ashit-rath
Copy link
Contributor

@dilippitchika Please do consider all the Select family widgets just for the sake of future reference.

@dilippitchika
Copy link
Contributor

@ashit-rath the challenge i see is with the CSV behavior in multiselect. I need some clarity there on what we are supporting currently in default values - @Tooluloope can you let me know?

@dilippitchika
Copy link
Contributor

Adding my notes here for the part i am confident of for Multi select widget

Default value with server side filtering OFF- MultiSelect widget

  1. Supported formats - [values], [{label,value}]
  2. When any value from default is not present in the list of options
    • The value will not be shown by default in the multiselect widget, if all values are missing no default should be multiselect widget
    • The default value field in property pane should show an error
      • Error message - "Some or all default values are missing from options. Please update the values."
  3. When the label is different from the one configured in the default and the options
    • The default label(s) will be shown from the options and not from the data in the default values field.
      • The selectedOptionLabels and selectedOptionValues should populate data of value from default and label from options

Default value with server side filtering ON- MultiSelect widget

  1. Supported formats -[values], [{label,value}]
  2. When value is not present in list of options
    • Format is [values], then we throw an error message
      • Default value is missing in options. Please use [{label : <string | num>, value : < string | num>}] format to show default for server side data
    • Format is [{label,value}] then we show the these as the default labels and values in the multi-select widget
  3. When value is present in list of options
    • Similar to server side filtering OFF; We show the default from the list of options
    • If the label is different between default and the option then, the default label(s) will be shown from the options and not from the data in the default values field
      • The selectedOptionLabels and selectedOptionValues should populate data of value from default and label from options

Not considering CSV here, need discussion on that.

@dilippitchika
Copy link
Contributor

@Tooluloope @vivekverma2312 I think this issue is linked to select default changes, please verify this and and link the PR here as well.

@Tooluloope
Copy link
Contributor

fixed in #15133

@somangshu somangshu added the QA Needs QA attention label Aug 9, 2022
@chandannkumar chandannkumar added Verified When issue is retested post its fixed and removed QA Needs QA attention labels Aug 19, 2022
@Nikhil-Nandagopal Nikhil-Nandagopal added the Widgets & Accelerators Pod Issues related to widgets & Accelerators label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working High This issue blocks a user from building or impacts a lot of users MultiSelect Widget Issues related to MultiSelect Widget MultiTree Select Widget Issues related to MultiTree Select Widget Production Select Widget Select or dropdown widget TreeSelect Issues related to TreeSelect Widget Verified When issue is retested post its fixed Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets
Projects
None yet