Multiselect not displaying initial values

4 posts, 0 answers
  1. Robert
    Robert avatar
    7 posts
    Member since:
    Jul 2012

    Posted 10 May 2013 Link to this post

    I have a MultiSelect bound via Ajax to a server controller. The MultiSelect properly shows the server data
    and provides filter criteria from the keyboard. But when the control is initialized, if I provide values to it they are not visible until after I click inside the Multiselect control. If I provide a value for the Placeholder text, only the first tow characters of it are displayed until I click on the control. After selecting the control, the initial values are displayed and it all works as expected. The control is defined with an Mvc helper, the ViewBag.TagArray in the snippet below is a string array with the values that should be displayed as already selected.

    thanks in advance for any help

    @(Html.Kendo().MultiSelect()
                   .Name("ajaxTags")
                   .Placeholder("Select tags...")
                   .AutoBind(false)
                   .DataTextField("Subject")
                   .DataValueField("Name")
                   .Filter("contains")  
                   .DataSource(source =>
                    {
                       source.Read(read =>
                       {
                           read.Action("AjaxGetTags", "Tag"); 
                       });
                       source.ServerFiltering(true);
                       source.Events(events => events.Error("kendoOnError"));
                    })
                   .HtmlAttributes(new { style = "width: 99%;" })
                   .Value(ViewBag.TagArray)
                   )
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 13 May 2013 Link to this post

    Hello Robert,

     
    When AutoBind is set to false, then the widget has no data and it is not able to show pre-selected values. This limitation is addressed in the latest internal build of Kendo UI and will also be available in Q1 2013 service pack due the mid of May 2013. You can check this link, which shows how to handle this.

    Regards,
    Georgi Krustev
    the Telerik team
    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
  4. Rodney
    Rodney avatar
    24 posts
    Member since:
    Jan 2011

    Posted 21 May 2015 in reply to Georgi Krustev Link to this post

    I'm having a similar issue using "serverFiltering: true". I'm trying to set the value after the KendoMultiSelect has been initialized. 

     The code I'm trying is: 

    // Remove previous selected Filters. 
    $("#noteTags").data("kendoMultiSelect").dataSource.filter({});
    // Load the set values.
    $("#noteTags").data("kendoMultiSelect").value(result.Tags);

     Am I doing it correctly. Is there a known issue with this? If so, is it also fixed in a particular version?

  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 25 May 2015 Link to this post

    Hello Rodney,

    In general, the code you've posted should work. Please give a try with the latest official release of Kendo UI (2015.1.429). If it does not work, then I will ask you to send us a repro demo. It will help to understand the case.

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