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

EnableScreenBoundaryDetection not working

2 Answers 214 Views
SearchBox
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
Fit2Page asked on 12 Feb 2018, 01:34 PM
I set it to true but dropdown outside the viewport: see screenshot.

2 Answers, 1 is accepted

Sort by
0
Accepted
Peter Milchev
Telerik team
answered on 15 Feb 2018, 11:15 AM
Hello Marc,

The following implementation improves the boundary detection to consider the side boundaries.

<script>
    function OnClientLoad(sender, args) {
        sender._dropDown.on({ "reflowed": sender._onReflowed }, sender);
    }
 
    Telerik.Web.UI.RadSearchBox.prototype._onReflowed = function () {
        var that = this;
                        
        var $animationContainer = $(that._dropDown._animationContainer);
 
        if (that._enableScreenBoundaryDetection) {
            var availableSpace = that._dropDown._getAvailableSpace();
            var tableWidth = $(that._innerWrapElement).outerWidth();
            var dropDownWidth = $animationContainer.outerWidth();
            var overflow = dropDownWidth - (tableWidth + availableSpace.right);
 
            if (overflow > 0) {
                var left = parseInt($animationContainer.css("left"), 10);
                var newLeft = Math.max(left - overflow, left - (dropDownWidth - tableWidth));
 
                $animationContainer.css("left", newLeft);
            }
        }
    }
</script>
<telerik:RadSearchBox runat="server" ID="RadSearchBox1"
    DataTextField="ShipName" EnableDirectionDetection="true" OnClientLoad="OnClientLoad" EnableScreenBoundaryDetection="true" DropDownSettings-Width="500px" DataValueField="OrderID">
</telerik:RadSearchBox>

We have also created a Feature request in our Telerik AJAX Feedback and Ideas portal: https://feedback.telerik.com/Project/108/Feedback/Details/242128-improve-radsearchbox-screen-side-boundary-detection.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
answered on 15 Feb 2018, 01:32 PM
This is working very well Peter, thank you!
Tags
SearchBox
Asked by
Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Peter Milchev
Telerik team
Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
Share this question
or