appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
33.84k stars 3.65k forks source link

[Bug]: Data validation based on unfiltered table instead of filtered table #31105

Open eedwardsSGS opened 7 months ago

eedwardsSGS commented 7 months ago

Is there an existing issue for this?

Description

When searching/filtering a table, items that use currentRow to determine their max or min value use the data from the unfiltered table instead of the filtered currentRow.

My use case is a table of quantities to prepare where the user inputs how many they have prepared, they should not be able to prepare more than the amount that is ordered, but when they filter the table to find a specific order, the data validation no longer works as expected.

Steps To Reproduce

  1. Create a table

  2. Populate it with 4 rows of data: ID | maxQty | Qty 10 | 1 | 0 11 | 5 | 0 20 | 4 | 0 21 | 8 | 0

  3. Make qty editable and set the maximum valid amount to table.currentRow.maxQty

  4. Search the table for "2", hiding the first two rows and moving the second two rows up to the first two.

  5. Edit the quantity for ID 20 to be 1. This is valid. Edit it to be 2, this is not valid but should be.

  6. Edit the quantity for ID 21 to be 4. This is valid. Edit it to be 7, this is not valid but should be.

Public Sample App

No response

Environment

Production

Issue video log

No response

Version

Self Hosted - 1.6.60

Nikhil-Nandagopal commented 6 months ago

@eedwardsSGS this seems to work for me. The maxQty is based on the row that you are editing and has nothing to do with the filtered or unfiltered data. So I'm unable to understand the problem here. Please check whether the column type is correctly set to number for maxQty.

eedwardsSGS commented 6 months ago

A support team member replicated it before I opened the ticket. Loom video: https://www.loom.com/share/58c88695fb9c4e53aaee88fb6eb87dbb?sid=a9c570f9-a89e-4470-8d29-4be43b557413

Table data: {{[{id: 10, maxQty: 1, qty: 0}, {id: 11, maxQty: 5, qty: 0}, {id: 20, maxQty: 4, qty: 0}, {id: 21, maxQty: 8, qty: 0}] }}

Correction to my max number, set in qty: {{currentRow.maxQty}}

Confirmed columns were correctly set to number.

Nikhil-Nandagopal commented 6 months ago

@eedwardsSGS thanks for the video. This makes it clear