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]: Select widget should display label instead of value while editing a table cell #26188

Closed
1 of 2 tasks
keyurparalkar opened this issue Aug 9, 2023 · 14 comments · Fixed by #34743 or #35124
Closed
1 of 2 tasks
Assignees
Labels
Bug Something isn't working Help enterprise Requested by Appsmith customers or prospects High This issue blocks a user from building or impacts a lot of users Production QA Pod Issues under the QA Pod QA Needs QA attention Table Widget Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets

Comments

@keyurparalkar
Copy link
Contributor

keyurparalkar commented Aug 9, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Description

Whenever a select column type cell is editable and when user actually selects the value from drop down for the cell, then select option's value property is updated in cell's data. It is expected that select option's label property should get updated in cell data.

Steps To Reproduce

  1. Drag and drop a table widget and bind a query to this widget.
  2. Change one of it's column to select type and add select options to it.
  3. Make this column editable
  4. Now try to edit this cell
  5. Observe that selecting an option from the select dropdown sets the cell's data to the value property of select option instead of label

Public Sample App

No response

Environment

Production

Issue video log

No response

Version

Cloud

Tasks

Preview Give feedback
  1. Task
    keyurparalkar
  2. Documentation Documentation Pod Needs More Info Table Widget Task Widgets & Accelerators Pod Widgets Product
    keyurparalkar

Front logo Front conversations

@keyurparalkar keyurparalkar added Bug Something isn't working Table Widget High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage labels Aug 9, 2023
@keyurparalkar keyurparalkar self-assigned this Aug 9, 2023
@github-actions github-actions bot added the Widgets Product This label groups issues related to widgets label Aug 9, 2023
@dilippitchika
Copy link
Contributor

  1. Whenever a column is set to select, by default we show labels and not values.
  2. For existing tables, since we have created this problem we ensure we don't break their apps. We will give an option called "Display As" as suggested in the original issue and for new select columns, it will be Label and for existing columns, it will be Value.
  3. We make it clear that the computed value here refers to the default value/display value.
  4. We make the select widget changes we did for options in the table and json form as well, create a new issue for this.
  5. When the user has turned on server side filtering, we will ask the user to provide additional details for labels to be shown for cases where we cannot find them in options.
  6. Depending on the "display as" property, we alter the search, sort and filter behavior accordingly.

@keyurparalkar @sbalaji1192

@keyurparalkar
Copy link
Contributor Author

@dilippitchika I have raised a new feature request for point 4 mentioned above.

@somangshu
Copy link
Contributor

@rishabhrathod01 you think this is realted to #30074

@Nikhil-Nandagopal Nikhil-Nandagopal changed the title [Bug]: Value property of select option is set for a cell while editing table data [Bug]: Select widget should display label instead of value while editing a table cell Feb 2, 2024
@MAL0780
Copy link

MAL0780 commented Feb 7, 2024

Please, prioritize.
Wanted to use select in a table visualizing "labels" and using "values".
Thank you!

@Scrafi4
Copy link

Scrafi4 commented Feb 16, 2024

Hello!

I've created a public app to demonstrate a bug observed in the "gender" column. You can access the app here:
https://app.appsmith.com/app/select-in-column-bug/page1-65cee8067b1fda250a586c71?embed=true

The issue occurs when I attempt to edit a cell within this column and select a different option. Instead of displaying the labels "female" or "male", the cell shows the numerical values 1 or 2, respectively. Here's the data structure I'm using for the dropdown options:

[
  {
    "label": "female",
    "value": 1
  },
  {
    "label": "male",
    "value": 2
  }
]

I'm building an app where managers update client cities from a set list. This bug hurts a lot and makes updates with foreign key relations basically impossible.
изображение
изображение

@AndreeaIAM
Copy link

Please, prioritize.
I have the same problem as [Scrafi4] .
Thank you!

@somangshu somangshu removed the Needs Triaging Needs attention from maintainers to triage label Mar 12, 2024
@neilhanhan
Copy link

I have the same problem.
Please, prioritize.
Thanks!

@rlnorthcutt
Copy link

We had another customer hit this today.

@rlnorthcutt
Copy link

I think we have a duplicate issue here: #21993

@rlnorthcutt
Copy link

For context, see this screen shot. If I want to edit a field with a select, then I see the value (an id) as the default, but I can see the label when I'm selecting... but then once it is selected, I see the value again. This takes a very simple and powerful feature of the table, and makes it unusable.

In theory, I could parse the DB data, swap out the ids for the labels, and then try to swap them back again before saving to the DB... but this is incredibly messy. For now, it is best to use a JSON form for the editing, which severely limits the edit capabilities of the table row.

image

@bastien-naturavelo
Copy link

Looking forward for a fix :)

@awalters141
Copy link

I would also like this to be worked on. I need my users to be able to select from just the label without seeing the value. Thank you.

@jacquesikot jacquesikot self-assigned this Jul 4, 2024
@appsmith-bot appsmith-bot added the QA Needs QA attention label Jul 9, 2024
@github-actions github-actions bot added the QA Pod Issues under the QA Pod label Jul 9, 2024
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this issue Jul 10, 2024
…e widget (appsmithorg#34743)

## Description
**Issue**
In the table widget, the select column currently displays the value from
the dropdown when a user makes a selection, rather than the label. This
behaviour is inconsistent with the standalone select widget, which
correctly renders the label upon selection.

**Fix**
This PR addresses the inconsistency by modifying the table widget's
select column to display the label of the selected item, ensuring
alignment with the behaviour of the standalone select widget.


Fixes appsmithorg#26188

## Automation

/ok-to-test tags="@tag.Table, @tag.Binding, @tag.Widget, @tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9843945454>
> Commit: 330d0d3
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9843945454&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Table, @tag.Binding, @tag.Widget, @tag.Sanity`
> Spec:
> <hr>Mon, 08 Jul 2024 18:21:02 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Updated the `SelectCell` component to use the `option.label` instead
of `option.value` for item selection.
  
- **Tests**
- Revised test descriptions and assertions for select options in Table
Widget to reflect the new functionality of using labels as values in
select cells.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@jacquesikot jacquesikot reopened this Jul 12, 2024
@carinanfonseca carinanfonseca added the Help enterprise Requested by Appsmith customers or prospects label Jul 16, 2024
@magliok-wwt
Copy link

We have hit this same issue.

@magliok-wwt
Copy link

Is this fixed for anyone else? I don't see that this is fixed/updated to v1.32

The table control still initially shows the value from query (the value of the select options in my case), and even after a new selection, the same thing happens and the table goes back to the value. Label is only ever used/shown once you're editing the value.

image

MajaharZemoso pushed a commit to MajaharZemoso/appsmith that referenced this issue Jul 28, 2024
## Description
**Issue**
In the table widget, the select column currently displays the value from
the dropdown when a user makes a selection, rather than the label. This
behaviour is inconsistent with the standalone select widget, which
correctly renders the label upon selection.

**Fix**
This PR addresses the inconsistency by modifying the table widget's
select column to display the label of the selected item, while
maintaining the table cell value and ensuring alignment with the
behaviour of the standalone select widget.

**Tested Cases**
Manual Test Cases for Table Select Widget Improvement

1. Default Value Display
**Objective:** Ensure that a new table displays the correct default
label key from the selectOptions in the cell.
**Steps:**
- Drop a new table widget.
- Add sample data to the table.
- Set a column (e.g., gender) to select type.
- Verify that the table cell displays the value from the label key of
the `selectOptions` by default.

2. Binding Check for Selected Row
**Objective:** Ensure that the table binding for the selected row
reflects the correct value key from the selectOptions.
**Steps:**
- Drop a new table widget.
- Add sample data to the table.
- Set a column (e.g., gender) to select type.
- Select a row and verify that `Table1.selectedRow.gender` matches the
value key from the `selectOptions`.

3. Updating Table Cell Content
**Objective:** Verify that updating the table cell content via the
dropdown updates the cell with the correct label key property.
**Steps:**
- Drop a new table widget.
- Add sample data to the table.
- Set a column (e.g., gender) to select type.
- Change the content of the table cell using the dropdown.
- Confirm that the cell content updates accordingly with the value key
property.

4. Add New Row Functionality
**Objective:** Ensure that adding a new row works as expected with the
enhanced functionality.
**Steps:**
- Drop a new table widget.
- Add sample data to the table.
- Set a column (e.g., gender) to select type.
- Add a new row to the table.
- Verify that the new row uses the label key property from the
`selectOptions` in the table display.

5. Deployed Mode Verification
**Objective:** Verify that the display functionality works correctly in
deployed mode.
**Steps:**
- Drop a new table widget.
- Add sample data to the table.
- Set a column (e.g., gender) to select type.
- Change the displayAs property to both value and label.
- Deploy the table.
- Verify that the table displays correctly in both value and label modes
in the deployed environment.


Fixes appsmithorg#26188

## Automation

/ok-to-test tags="@tag.Table, @tag.Binding, @tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10080592979>
> Commit: 78b268d
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10080592979&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Table, @tag.Binding, @tag.Sanity`
> Spec:
> <hr>Wed, 24 Jul 2024 17:17:06 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Improved display of selected options in table widgets by showing the
corresponding label instead of the raw value.
- Introduced a feature flag to toggle the table cell label value
functionality.

- **Bug Fixes**
- Enhanced test cases to ensure accurate validation of select options
behavior within the table widget.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@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 Help enterprise Requested by Appsmith customers or prospects High This issue blocks a user from building or impacts a lot of users Production QA Pod Issues under the QA Pod QA Needs QA attention Table Widget Widgets & Accelerators Pod Issues related to widgets & Accelerators Widgets Product This label groups issues related to widgets
Projects
None yet