Restricting duplicate drop-down rows in editable grid

I have this requirement.

We have two columns in editable grid which are of drop-down fields.and we select one value  in each column of first row and we  add second row now and in this row we select same value that was given in the first row first column ,the second row second column should not display the value of first row second column value in the drop-down . A proper validation would be very helpful

Regards,

Satya

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    The way I'm thinking I would solve this problem is to have 2 copies of the same array of choice Labels and choice Values, then remove() from both lists for the second set at the index of the one chosen from the first set.

    {1, 2, 3} {Choice 1, Choice 2, Choice 3}  User selects choice 2,

    remove(local!choiceValues2, whereContains(local!choiceLabels1, "choice 2"))

    remove(local!choiceLabels2, whereContains(local!choiceLabels1, "choice 2"))

    It would probably be best to leave the second one disabled until you've made a selection from the first one, and disable the first one after you've made a selection in the second one, or reset the second dropdown choice to null every time you change the first, otherwise you'll find yourself making a pink box every time you remove the one you have currently selected from the list.

Reply
  • 0
    Certified Lead Developer

    The way I'm thinking I would solve this problem is to have 2 copies of the same array of choice Labels and choice Values, then remove() from both lists for the second set at the index of the one chosen from the first set.

    {1, 2, 3} {Choice 1, Choice 2, Choice 3}  User selects choice 2,

    remove(local!choiceValues2, whereContains(local!choiceLabels1, "choice 2"))

    remove(local!choiceLabels2, whereContains(local!choiceLabels1, "choice 2"))

    It would probably be best to leave the second one disabled until you've made a selection from the first one, and disable the first one after you've made a selection in the second one, or reset the second dropdown choice to null every time you change the first, otherwise you'll find yourself making a pink box every time you remove the one you have currently selected from the list.

Children
No Data