RadSplitBar - client-side drag event

2 Answers 26 Views
Splitter
Karl-Heinz
Top achievements
Rank 1
Karl-Heinz asked on 12 Dec 2024, 12:14 PM

Dear team members,

Is it possible to catch a drag event on client-side that occurs when a RadSplitBar is being dragged? I want to display the change of the position continuously.

Kind Regards

2 Answers, 1 is accepted

Sort by
0
Vasko
Telerik team
answered on 12 Dec 2024, 01:47 PM

Hello,

To capture and display the continuous position change of a RadSplitter during a drag event on the client-side, you can use the OnClientResizing event of the RadSplitter control. This event is triggered continuously as the user drags the split bar, allowing you to monitor and display the position changes in real-time.

The OnClientResizing event is advantageous because it provides a seamless way to capture and respond to resizing actions, including split bar drags, without requiring additional setup or handling of separate events.

For more details on client-side programming for RadSplitter, refer to the official documentation:

Feel free to adjust the implementation to fit your specific requirements.

Please refer to the following articles for additional information:

Regards,
Vasko
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Karl-Heinz
Top achievements
Rank 1
commented on 20 Dec 2024, 03:40 PM

Dear team members,

 

The OnClientResizing event does not solve my problem. I added the handler on client-side using add_resizing.

Like add_resized, the event is not triggered when I'm dragging the RadSplitbar. It's only triggered after resizing the element that contains the splitter (resize of browser window etc.).

Additionally, I added the handler for the first pane in the splitter.

Code snippet:

var pane = splitter.getStartPane();
pane.add_resizing(this._resizeEvt);

 

Now, the the resizing event is triggered as expected. But unfortunately, it's only triggered once like the resized event, not continuously.

 

Kind Regards

 

0
Attila Antal
Telerik team
answered on 23 Dec 2024, 04:06 PM

Hi Karl-Heinz,

The Splitbar handles the Drag event internally, but there are no Properties/Methods exposed to the public. Nevertheless, you can override the built-in function and inject your JavaScript function which will be called when the Dragging the Splitbar.

Example:

(function () {
    try {
        // Store the original function in a variable
        var original_onDrag = Telerik.Web.UI.RadSplitBar.prototype.onDrag;

        // Override the original function
        Telerik.Web.UI.RadSplitBar.prototype.onDrag = function (args) {
            // Call the original function first
            original_onDrag.call(this, args); 

           // Inject your Custom Handler
            SplitbarOnDrag(this, args); 
        }
    } catch (e) {

    }
})();

// The Custom Drag Handler function
function SplitbarOnDrag(sender, args) {
    // do something here...
}

 

Regards,
Attila Antal
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Tags
Splitter
Asked by
Karl-Heinz
Top achievements
Rank 1
Answers by
Vasko
Telerik team
Attila Antal
Telerik team
Share this question
or