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

Multiselect not displaying initial values

3 Answers 1664 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 10 May 2013, 08:03 PM
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)
               )

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 13 May 2013, 12:25 PM
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!
0
Rodney
Top achievements
Rank 2
answered on 22 May 2015, 01:19 AM

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?

0
Georgi Krustev
Telerik team
answered on 25 May 2015, 02:34 PM
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!
 
Tags
MultiSelect
Asked by
Robert
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Rodney
Top achievements
Rank 2
Share this question
or