JavaScript/jQuery Resizable API
DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.
The following code shows how to create the Resizable widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.
jQuery
$(function() { $("#resizable").dxResizable({ width: 200, height: 200, minWidth: 30, minHeight: 30, maxWidth: 500, maxHeight: 500 }); });
<div id="resizable"> <div id="content"></div> </div>
#content { height: 100%; width: 100% }
Angular
<dx-resizable [width]="200" [height]="200" [minWidth]="30" [minHeight]="30" [maxWidth]="500" [maxHeight]="500"> <div id="content"></div> </dx-resizable>
#content { height: 100%; width: 100% }
import { DxResizableModule } from "devextreme-angular" // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxResizableModule ], // ... })
AngularJS
<div dx-resizable="{ width: 200, height: 200, minWidth: 30, minHeight: 30, maxWidth: 500, maxHeight: 500 }"> <div id="content"></div> </div>
#content { height: 100%; width: 100% }
Knockout
<div data-bind="dxResizable: { width: 200, height: 200, minWidth: 30, minHeight: 30, maxWidth: 500, maxHeight: 500 }"> <div id="content"></div> </div>
#content { height: 100%; width: 100% }
ASP.NET MVC Controls
@(Html.DevExtreme().Resizable() .ID("resizable") .Width(200) .Height(200) .MinWidth(30) .MinHeight(30) .MaxWidth(500) .MaxHeight(500) .Content(@<text> <div id="content"></div> </text>) )
@Code Html.DevExtreme().Resizable() _ .ID("resizable") _ .Width(200) _ .Height(200) _ .MinWidth(30) _ .MinHeight(30) _ .MaxWidth(500) _ .MaxHeight(500) _ .Content(Sub() @<text> <div id="content"></div> </text> End Sub).Render() End Code
#content { height: 100%; width: 100% }
See Also
Options
Name | Description |
---|---|
elementAttr |
Specifies the attributes to be attached to the widget's root element. |
handles |
Specifies which borders of the widget element are used as a handle. |
height |
Specifies the widget's height. |
maxHeight |
Specifies the upper height boundary for resizing. |
maxWidth |
Specifies the upper width boundary for resizing. |
minHeight |
Specifies the lower height boundary for resizing. |
minWidth |
Specifies the lower width boundary for resizing. |
onDisposing |
A function that is executed before the widget is disposed of. |
onInitialized |
A function that is executed only once, after the widget is initialized. |
onOptionChanged |
A function that is executed after a widget option is changed. |
onResize |
A function that is executed each time the widget is resized by one pixel. |
onResizeEnd |
A function that is executed when resizing ends. |
onResizeStart |
A function that is executed when resizing starts. |
rtlEnabled |
Switches the widget to a right-to-left representation. |
width |
Specifies the widget's width. |
Methods
Name | Description |
---|---|
beginUpdate() |
Prevents the widget from refreshing until the endUpdate() method is called. |
defaultOptions(rule) |
Specifies the device-dependent default configuration options for this component. |
dispose() |
Disposes of all the resources allocated to the Resizable instance. |
element() |
Gets the root widget element. |
endUpdate() |
Refreshes the widget after a call of the beginUpdate() method. |
getInstance(element) |
Gets the instance of a widget found using its DOM node. |
instance() |
Gets the widget's instance. Use it to access other methods of the widget. |
off(eventName) |
Detaches all event handlers from a single event. |
off(eventName, eventHandler) |
Detaches a particular event handler from a single event. |
on(eventName, eventHandler) |
Subscribes to an event. |
on(events) |
Subscribes to events. |
option() |
Gets all widget options. |
option(optionName) |
Gets the value of a single option. |
option(optionName, optionValue) |
Updates the value of a single option. |
option(options) |
Updates the values of several options. |
Events
Name | Description |
---|---|
disposing |
Raised before the widget is disposed of. |
initialized |
Raised only once, after the widget is initialized. |
optionChanged |
Raised after a widget option is changed. |
resize |
Raised each time the widget is resized by one pixel. |
resizeEnd |
Raised when resizing ends. |
resizeStart |
Raised when resizing starts. |
If you have technical questions, please create a support ticket in the DevExpress Support Center.