This is a migrated thread and some comments may be shown as answers.

How to deactivate the selected item

2 Answers 11 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
NHJ
Top achievements
Rank 1
NHJ asked on 02 Jan 2020, 09:39 AM

Hello,

There is a question that needs to be solved first.

Q. How do multiple dropdownlists use a single datasource?


This question is not "showing the same data".
(call by value)

"Accessing only one data source address that shares data attributes, changed current values, etc."
(call by address)


If this question is resolved, you should move on to the next question.

The solution I want is this:

All dropdownlists exist in multiple rows in a grid.


If you selected data 0 in row 0, you should not be able to select data 0 in another row.

I've seen the example below, but it's not a way to disable the data I've selected, only to manually disable it.

https://docs.telerik.com/kendo-ui/controls/editors/dropdownlist/how-to/selection/disable-items-for-selection

What is the way?

2 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 06 Jan 2020, 09:31 AM

Hello Nam,

Thank you for contacting us.

The approach to bind a single dataSource to a multiple dropdownlists in a Grid, you can refer to this Grid Demo which I believe demonstrates the desired scenario. 

As for disabling the items, I am currently looking for a possible way to do that. I will contact shortly with my findings.

Thank you for your patience.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Martin
Telerik team
answered on 06 Jan 2020, 05:07 PM

Hello Nam,

My apologies for the late reply.

A possible approach to disable items that have already been selected is to use the items method of the Grid in the save event to get the values of the DropDownLists. You can add them in an array, which you can store in the localStorage.

Then, in the open event of the AutoComplete, you can add class k-state-disabled for every k-item element, whose text is equal to an item from the selected values which I stored in the array. You can see the suggested approach in action in this Dojo example.

Let me know if that works for you. Feel free to get back to me if you have any questions.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DropDownList
Asked by
NHJ
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or