DropDownList

6 posts, 0 answers
  1. Rocio
    Rocio avatar
    28 posts
    Member since:
    Dec 2015

    Posted 05 Jan Link to this post

     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>

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 08 Jan Link to this post

    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!
     
  3. Rocio
    Rocio avatar
    28 posts
    Member since:
    Dec 2015

    Posted 11 Jan in reply to Georgi Krustev Link to this post

    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");
        

  4. Rocio
    Rocio avatar
    28 posts
    Member since:
    Dec 2015

    Posted 11 Jan in reply to Rocio Link to this post

    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
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 14 Jan Link to this post

    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!
     
  6. Rocio
    Rocio avatar
    28 posts
    Member since:
    Dec 2015

    Posted 14 Jan in reply to Georgi Krustev Link to this post

    The whole issue got resolved when I updated Telerik version. It seems that the versions being used in our application was too old.
Back to Top