How to deactivate the selected item

3 posts, 0 answers
  1. NHJ
    NHJ avatar
    59 posts
    Member since:
    Nov 2019

    Posted 02 Jan Link to this post

    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. Martin
    Admin
    Martin avatar
    183 posts

    Posted 06 Jan Link to this post

    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.
  3. Martin
    Admin
    Martin avatar
    183 posts

    Posted 06 Jan Link to this post

    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.
Back to Top