How to reference a Dropdownlist which uses "data-container-for"

6 posts, 2 answers
  1. Paul
    Paul avatar
    24 posts
    Member since:
    May 2016

    Posted 08 Jul Link to this post

    I am having a lot of trouble referencing a drop down list which does not have an ID but it has a data-container-for.

     

    All i am trying to do is get the selected value in the dropdown list.

    I have tried this which usually works when you have an ID.

    var dd = $("#DashboardTypeId").data("kendoDropDownList");

    any help would be appreciated 

  2. Answer
    Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    349 posts

    Posted 11 Jul Link to this post

    Hi Paul,

    You can use the attribute equals jQuery selector, e.g.:

    var ddl = $('[data-container-for="custom-name"]').data('kendoDropDownList');

    ... to get a reference to the corresponding DropDownList, after the widget has been initialized, and then the the value() method:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#methods-value

    I have prepared a simple dojo to illustrate the described approach:

    http://dojo.telerik.com/UwUje

    I hope this helps.

    Regards,
    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. Kendo UI is VS 2017 Ready
  4. Paul
    Paul avatar
    24 posts
    Member since:
    May 2016

    Posted 12 Jul in reply to Dimiter Topalov Link to this post

    Excellent I will give that a go. one way i found was to use an onchange function and intersect it then store the value in a var.

     

  5. Paul
    Paul avatar
    24 posts
    Member since:
    May 2016

    Posted 17 Oct Link to this post

    Hi I now have another issue with a data container and a kendo grid.

    I am now trying to refresh the data in the container. I currently have an array which i pass to the kendo grids column attribute like so - 

     { field: "RoleId", values: roleNames, title: "Role", id:"RoleId" }

     

    Which works fine as long as i dont want to update roleNames but unfortunately i need to update the data. I am currently double clicking on the row and the data is populated into a kendo window, where i can change the data. one of the data fields is a drop down field with roleNames as the data.

    Is there any way i can achieve this everything i have tried does not work apart from initialising the grid but then my double click doesn't work.-  

    $(tempUserhostDiv).delegate("tbody>tr", "dblclick", function ()
            {
                editSelectedUser();            
            });

    all this function does is call the edit function. What happens when i double click the row it pops up but then goes away straight away. but if i manually call the edit function it stays.

     

    Any help would be appreciated.

  6. Answer
    Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    349 posts

    Posted 19 Oct Link to this post

    Hi Paul,

    I tried to simulate the described scenario, but the Grid editing seems to work as expected on my end:

    http://dojo.telerik.com/UMExo/2

    Can you please compare the example above to your implementation, and apply the necessary adjustments. If the problem persists, please send us a similar isolated runnable project, where the issue can be observed, so we can inspect it further? Thank you in advance.

    On a side note, please open a new thread for questions that are not related to the thread's original topic and scenario. This will facilitate a tidier support history of your account and better support service.

    Regards,
    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  7. Paul
    Paul avatar
    24 posts
    Member since:
    May 2016

    Posted 19 Oct Link to this post

    For some reason it seems to be working fine now. thank you.
Back to Top
Kendo UI is VS 2017 Ready