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

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

5 Answers 869 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 08 Jul 2016, 10:46 AM

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 

5 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 11 Jul 2016, 02:11 PM
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.
0
Paul
Top achievements
Rank 1
answered on 12 Jul 2016, 08:51 AM

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.

 

0
Paul
Top achievements
Rank 1
answered on 17 Oct 2016, 01:47 PM

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.

0
Accepted
Dimiter Topalov
Telerik team
answered on 19 Oct 2016, 08:17 AM
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.
0
Paul
Top achievements
Rank 1
answered on 19 Oct 2016, 08:39 AM
For some reason it seems to be working fine now. thank you.
Tags
DropDownList
Asked by
Paul
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Paul
Top achievements
Rank 1
Share this question
or