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

[Solved] Set ComboBox client side, animation never stops spinning

5 Answers 149 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ryan
Top achievements
Rank 2
Ryan asked on 27 Dec 2011, 06:06 PM
I am trying to set a comboBox client side.  My code is below.  The code works in that the AJAX request is made properly and the proper value/text is set in the comboBox.  The problem is there is a "Loading" animation that never stops.  What am I doing wrong here?

<div class="editor-item-line">                 
<div class="editor-label">                     
<%: Html.LabelFor(m => m.Entity.EmployeeId)%>                 
</
div>                 
<
div class="editor-field">                     
<%
: Html.Telerik().ComboBoxFor(m => m.Entity.EmployeeId)                         
.DataBinding(databinding =>                              
databinding.Ajax().Select("GetUsersForComboBox""User")                             
.Cache(false))                         
.HighlightFirstMatch(true)                         
.AutoFill(true)%>                     
<%
: Html.ValidationMessageFor(m => m.Entity.EmployeeId)%>                 
</div>             
</div>

AND THEN LATER IN THE JAVASCRIPT SECTION:

var comboBox = $('#<%:Html.IdFor(m => m.Entity.EmployeeId)%>').data('tComboBox');                 
var
 selectItem = function(dataItem) {                     
return dataItem.Value == "<%:Model.Entity.EmployeeId%>";                 
}                 
comboBox.fill(function() {                     
    comboBox.select(selectItem);                
});

5 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 28 Dec 2011, 11:29 AM
Hi Ryan,

From the code block you shared I was unable to determine what causes the behavior you described.
Here is a list of things to check:
  • Make sure that the object returned as JsonResult is SelectList or IEnumerable<DropDownItem> 
  • Make sure the JavaScript is executed after the DropDownList is loaded (you can use the onLoad event 
    e.g.
    .ClientEvents(events=>events.OnLoad("onLoad"))

If this does not help I will need a sample project reproducing the behavior.

Regards,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Ryan
Top achievements
Rank 2
answered on 21 Feb 2012, 05:53 PM
As a follow up, it appears removing the portion .Cache(false) fixed my problem.

EDIT: After further testing, this is not the case.  It is still happening.
0
Mario
Top achievements
Rank 1
answered on 22 Apr 2012, 08:52 PM
Hello Support,

I have the same issue, when I bind the combobox using ajax, the ajax animation on the combobox never stop spinning

My scenario is as follows:

I have a form withing a "Window" component, there I have a combobox like this:
@(Html.Telerik().ComboBox()
.Name("ddPhysicianSalutation")
.AutoFill(true)
.DataBinding(binding => binding.Ajax().Select("_GetSalutations", "Referrals").Cache(false))
.HtmlAttributes(new { style = string.Format("width:{0}px", 217) })
.Filterable(filtering =>
{
filtering.FilterMode(AutoCompleteFilterMode.StartsWith);
})
.HighlightFirstMatch(true)
.OpenOnFocus(true)
)



This is how my controller returns the dataset:
[HttpPost]
public ActionResult _GetSalutations()
{
    List<KeyValuePair<string, string>> salutations = new List<KeyValuePair<string, string>>();
 
    //string tokenId = HttpContext.Session["tokenId"].ToString();
    string tokenId = "X";
    ReferralService service = new ReferralService(tokenId);
    salutations = service.GetSalutations();
 
    return new JsonResult   // return json result of Procedure Settings
    {
        Data = new SelectList(salutations, "Value", "Key")
    };
}


0
Petur Subev
Telerik team
answered on 23 Apr 2012, 12:59 PM
Hello Mario,

I suggest you to open a support ticket and attach a sample project which replicates the issue so we can check the exact setup.

Greetings,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Mario
Top achievements
Rank 1
answered on 24 Apr 2012, 08:03 PM
Hello Petur,

I noticed is an inconsistent behavior, let me try to nail down the root cause and I will get back to you

Thanks
Tags
ComboBox
Asked by
Ryan
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Ryan
Top achievements
Rank 2
Mario
Top achievements
Rank 1
Share this question
or