Browser crashes when adding Rad ComboBox Item with JavaScript

5 posts, 0 answers
  1. Matt
    Matt avatar
    97 posts
    Member since:
    Jun 2012

    Posted 24 Jun 2013 Link to this post

    I'm trying to set the value of a combo box that uses javascript to clear the items, add one, and set the only item as selected. Everything works except for setting the newly added item as the selected item. When this is triggered, it causes IE9 to crash.

    Any ideas? BTW, I'm using 2013 Q1.

    <telerik:RadComboBox ID="RCB_Build" runat="server" CheckBoxes="true" EmptyMessage="Select all that apply" OnClientSelectedIndexChanged="toggleFields"  EnableCheckAllItemsCheckBox="true" TabIndex="5" ToolTip="Select the schedule month(s)" AutoPostBack="false">
     <ExpandAnimation Type="OutExpo" Duration="300" />
     <CollapseAnimation Type="InExpo" Duration="200" />
                                    </telerik:RadComboBox>

    var RCB_Build = $find('<%=RCB_Build.ClientID%>');
    var rcbItem = new Telerik.Web.UI.RadComboBoxItem();
    rcbItem.set_text(n);
    rcbItem.set_value(fom);
    RCB_Build.trackChanges();
    RCB_Build.clearItems();
    RCB_Build.get_items().add(rcbItem);
    rcbItem.select();
    RCB_Build.commitChanges();
  2. Matt
    Matt avatar
    97 posts
    Member since:
    Jun 2012

    Posted 26 Jun 2013 Link to this post

    Anyone?

    Is there a way to use JavaScript to remove the option of a select all option?
  3. Nencho
    Admin
    Nencho avatar
    1812 posts

    Posted 27 Jun 2013 Link to this post

    Hello Matt,

    Would you elaborate a bit more on the scenario you attempt to achieve? Is the code snippet, where you are demonstrating how you are adding the new RadComboBoxItem, is placed in the OnClientSelectedIndexChanged client-side event handler? If the RadComboBox has its CheckBox functionality enabled, I would suggest you to use the OnClientItemChecked client-side event instead of the OnClientSelectedIndexChanged. In addition, I noticed that you are using the select() method, in order to check the newly added item. This is the reason why this functionality causes the browser to crash. In a checkboxes scenario, you should use the check() function instead.

    As for you other inquiry, regarding the removal of the "Check All" option, I would suggest you to use JQuery, in order to remove it. Please consider the following approach:     $telerik.$(".rcbCheckAllItems").hide()

    Regards,
    Nencho
    Telerik
    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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  4. Matt
    Matt avatar
    97 posts
    Member since:
    Jun 2012

    Posted 27 Jun 2013 Link to this post

    Thanks Nencho!

    I'm calling the function from another rad combobox (client selected change) and using what you suggested works perfectly.

    I wish I could have found that solution online though.
  5. Nencho
    Admin
    Nencho avatar
    1812 posts

    Posted 28 Jun 2013 Link to this post

    Hello Matt,

    I am glad to see that the issue is now resolved. Thank you for your feedback, we will update our documentation on the matter. However, an another approach is applicable, using the set_checked() method, like demonstrated in this help article.

    Regards,
    Nencho
    Telerik
    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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top