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

DropDownList

5 Answers 64 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rocio
Top achievements
Rank 1
Rocio asked on 05 Jan 2016, 02:46 PM

 Good morning I have the following dropdownlist that I'm trying to fill, but it is not working.  

kendo.bind($('#kdlResponsibleOffice'), vmOffices); gets undefined and I believe this is why the following code also fails.

$('#kdlResponsibleOffice').data('kendoDropDownList').bind('change', function () {
                updateSysInfoStringField(sie.sysInfoId, "ResponsibleOffice", this.value());
            });

 Any feedback is really appreciated.

 

Thank you,

 Rocio

populateOffice = function () {
    var sie = this;
    $.ajax({
        url: "Service/InventorySvc.asmx/GetOffices",
        success: function (r) {
            var os = r.d;
            offices = [];
 
            $.each(os, function (i, o) {
                var office = { FullName: o.OfficeName + ' - ' + o.OfficeFullName, ShortName: o.OfficeName };
                offices.push(office);
            });
 
            vmOffices = kendo.observable({offices: offices, responsibleOffice: sie.sysInfo.ResponsibleOffice});
            kendo.bind($('#kdlResponsibleOffice'), vmOffices);
 
            $('#kdlResponsibleOffice').data('kendoDropDownList').bind('change', function () {
                updateSysInfoStringField(sie.sysInfoId, "ResponsibleOffice", this.value());
            });
        }
    });

 

<tr>
    <td>Responsible Office: </td>
    <td><input id="kdlResponsibleOffice" data-role="dropdownlist" data-text-field="FullName" data-value-field="ShortName" data-bind="source:offices, value: responsibleOffice" style="width:550px" /></td>
</tr>

5 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 08 Jan 2016, 11:55 AM
Hello Rocio,

Prepared a simple demo based on the provided code snippets and it works just fine: Please modify it in order to reproduce the issue.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Rocio
Top achievements
Rank 1
answered on 11 Jan 2016, 12:41 PM

Good morning Georgi:

 $('#kdlResponsibleOffice').data('kendoDropDownList')   this part of the code returns Unable to get property 'value' of undefined or null reference , so I can not do a bind or a initial assigment: 

 $('#kdlResponsibleOffice').data('kendoDropDownList') .value("Off2");
    

0
Rocio
Top achievements
Rank 1
answered on 11 Jan 2016, 01:21 PM
I want to add this code to give you a better example of how the code is written.  I can't get it to work.  http://dojo.telerik.com/@rbordavol/UTIfu
0
Georgi Krustev
Telerik team
answered on 14 Jan 2016, 09:56 AM
Hello Rocio,

I reviewed the demo and noticed that the load function is not called at all. Once the implementation is fixed to properly call the initialization function, everything is OK:
Please note that the discussed issue is not related to Kendo UI DropDownList by any means, but rather is general programming issue and as such falls out of the scope of the entitled support service.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Rocio
Top achievements
Rank 1
answered on 14 Jan 2016, 12:20 PM
The whole issue got resolved when I updated Telerik version. It seems that the versions being used in our application was too old.
Tags
General Discussion
Asked by
Rocio
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Rocio
Top achievements
Rank 1
Share this question
or