Problem when trying to access a kendo multiselect object

2 posts, 0 answers
  1. Wayne
    Wayne avatar
    1 posts
    Member since:
    Oct 2012

    Posted 28 May 2015 Link to this post

    Hi 

     

    I wonder if anyone could help with an issue i am having with Kendo Multi-selection drop down lists.

    i have a button which manually populates the field in the code, however when i try to access the object with jquery it results in the control making a copy of itself

     Many Thanks,

     

    My MVC razor code

     <div class="col-md-2">
    @Html.Kendo().MultiSelectFor(m => m.SelectedMeasuringPoints).BindTo(Model.MeasuringPoints.Select(x => x.TrimStart('0'))).Placeholder("Select points...").TagTemplate("0000#: data #").HtmlAttributes(new { @ID = "MPMultiSelection" })
    </div> 

     

    /My javascript

    function selectDeselectAllMP() {

           //Get handle for the measuring point multi-selection
            var mpMultiselection = $('#MPMultiSelection').kendoMultiSelect().data("kendoMultiSelect");
        }

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 01 Jun 2015 Link to this post

    Hello Wayne,

    If you call your selectDeselectAllMP, function multiple times, then you will be initializing the widget multiple times which is not recommended/supported. If you want to get a reference of the widget you need to use the data() method directly on the jQuery element, without initializing it again.

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top