RadComboBox OnClientBlur never fires

7 posts, 0 answers
  1. Amarbir
    Amarbir avatar
    6 posts
    Member since:
    Nov 2018

    Posted 19 Aug Link to this post

    Upgraded UI for ASP.NET AJAX controls and OnClientBlur neverfires. Here is the markup:

    <telerik:RadComboBox ID="radComboHansenClerks" CheckBoxes="true" AutoPostBack="false"
                            LabelCssClass="control-label" AllowCustomText="false" CloseDropDownOnBlur="true"
                            OnClientBlur="IsCheckAllSelected" CheckedItemsTexts="DisplayAllInInput" ShowDropDownOnTextboxClick="true"
                            runat="server" Filter="Contains" NoWrap="True" MaxHeight="400px" Width="100%"
                            AccessibilityMode="true" EnableCheckAllItemsCheckBox="true" Localization-CheckAllString="Select All"
                            OnItemChecked="radComboHansenClerks_ItemChecked">
                             
                        </telerik:RadCombo
    function IsCheckAllSelected(sender, eventArgs) {                                              
                  $('#<%= btnRadclerksFilter.ClientID %>').click();               
          }
    Box>
  2. Amarbir
    Amarbir avatar
    6 posts
    Member since:
    Nov 2018

    Posted 19 Aug in reply to Amarbir Link to this post

    web UI verison: 2020.1.219.40
  3. Amarbir
    Amarbir avatar
    6 posts
    Member since:
    Nov 2018

    Posted 21 Aug Link to this post

    Is everyone on vacation?
  4. Doncho
    Admin
    Doncho avatar
    71 posts

    Posted 24 Aug Link to this post

    Hi Amarbir,

    I am afraid we are not aware of such an issue with the RadComboBox.

    A possible cause for the unexpected behavior could be an eventual JavaScript error on the page. I would suggest you use the DevTools of your browser to monitor the Console for errors. Check out the Improve Your Debugging Skills with Chrome DevTools blog post as it may help you with the troubleshooting.

    One more thing you can try In case you have Ajax enabled on the page, is to disable it temporarily and test the application while monitoring the Browser's Console for JavaScript errors again, see Get more descriptive errors by disabling AJAX.

    I have tested the provided declaration of the ComboBox and it works as expected on my side, see http://somup.com/cYjZQY6NO3
    I have used an alert method for testing:

    function IsCheckAllSelected(sender, eventArgs) {
        alert('OnClientBlur fired!');
    }

    If the suggested above is not helping in troubleshooting the issue we would need to see a reproduction of the problem in order to help. Please share the steps to replicate the problematic behavior so that we can inspect it locally. It would also be helpful if you provide us a runnable sample that will show us the problem.

    Kind regards,
    Doncho
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

  5. Amarbir
    Amarbir avatar
    6 posts
    Member since:
    Nov 2018

    Posted 24 Aug in reply to Doncho Link to this post

    Hi,

    Thank you for the response. Here is what I have noticed. In your example it works because you do not have any items. OnClientBlur get fired when it drops down and you go out of focus WITHOUT selecting anything(or making any changes to existing selection). It does NOT work after you change the selection. Try adding a few items and selecting one or two.

  6. Amarbir
    Amarbir avatar
    6 posts
    Member since:
    Nov 2018

    Posted 24 Aug in reply to Amarbir Link to this post

    BTW there are no errors in console (even after disabling ajax as you suggested). That's the first thing I checked before I posted this problem.
  7. Doncho
    Admin
    Doncho avatar
    71 posts

    Posted 27 Aug Link to this post

    Hi Amarbir,

    Thank you for the clarification! It helped me understand the issue.

    Indeed, this unexpected behavior has been reported in the following FeedbackItem - ComboBox' OnClientBlur not working correctly.

    For your convenience, I am pasting the code from the feedback item, that you can use as a workaround:

    <script>
    	var onDocumentClick = Telerik.Web.UI.RadComboBox.prototype._onDocumentClick;
    	Telerik.Web.UI.RadComboBox.prototype._onDocumentClick = function (e) {
    		if (!e) e = event;
    
    		var target = e.target || e.srcElement;
    
    		while (target.nodeType !== 9) {
    			if (!target.parentNode || target == this.get_element() || target == this.get_dropDownElement()) {
    				e.preventDefault();
    				return;
    			}
    
    			target = target.parentNode;
    		}
    		onDocumentClick.call(this, e);
    	};
    </script>

    I hope that will help! Please let me know if any further questions come up!

    Kind regards,
    Doncho
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

Back to Top