JavaScript/jQuery Drawer Options
This section describes properties that configure the Drawer UI component's contents, behavior and appearance.
activeStateEnabled
The UI component switches to the active state when users press down the primary mouse button. When this property is set to true, the CSS rules for the active state apply. You can change these rules to customize the component.
Use this property when you display the component on a platform whose guidelines include the active state change for UI components.
animationDuration
Specifies the duration of the drawer's opening and closing animation (in milliseconds). Applies only if animationEnabled is true.
closeOnOutsideClick
Event (jQuery or EventObject)
The raised event. It is a EventObject or a jQuery.Event when you use jQuery.
The function passed to this property enables you to specify a custom condition for UI component closing. For instance, you can prevent closing until a user clicks a specific element on the view:
- $(function() {
- $("#drawerContainer").dxDrawer({
- // ...
- closeOnOutsideClick: function(e) {
- return e.target === $("#someElement").get()[0];
- }
- });
- });
elementAttr
Specifies the global attributes to be attached to the UI component's container element.
height
This property accepts a value of one of the following types:
Number
The height in pixels.String
A CSS-accepted measurement of height. For example,"55px"
,"20vh"
,"inherit"
. If you want to specify a relative height, usevh
height measurements.Function (deprecated since v21.2)
Refer to the W0017 warning description for information on how to migrate to viewport units.
maxSize
Specifies the drawer's width or height (depending on the drawer's position) in the opened state.
minSize
Specifies the drawer's width or height (depending on the drawer's position) in the closed state.
onDisposing
A function that is executed before the UI component is disposed of.
Name | Type | Description |
---|---|---|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The UI component's instance. |
onInitialized
Name | Type | Description |
---|---|---|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The UI component's instance. |
onOptionChanged
Name | Type | Description |
---|---|---|
value | any |
The modified property's new value. |
previousValue | any |
The UI component's previous value. |
name |
The modified property if it belongs to the first level. Otherwise, the first-level property it is nested into. |
|
fullName |
The path to the modified property that includes all parent properties. |
|
element |
The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The UI component's instance. |
openedStateMode
The following modes are available:
"overlap"
The drawer overlaps the view. If you assign "overlap" to the openedStateMode property, the Drawer uses the Popup component to render a side menu. A z-index of all overlay UI components (Popup, Popover, etc.) on a page is calculated when a component is created and it takes into account the z-indexes of existing overlays. As a result, a newly opened Popup (the Drawer's panel) is displayed at the top. If you need to display a different window at the top, call the focus() method for the Popup after the openedStateMode property is changed."shrink"
The view's width decreases to accommodate the drawer."push"
The drawer partially displaces the view.
Note that if the value of this property changes, the Drawer template is re-rendered.
See Also
position
Use "before" and "after" if the Drawer should be positioned differently in right-to-left and regular representations. The following table shows the dependency between the rtlEnabled value and "before" and "after" positions:
"before" | "after" | |
---|---|---|
rtlEnabled: false | left side of the view | right side of the view |
rtlEnabled: true | right side of the view | left side of the view |
revealMode
The following modes are available:
"slide"
The drawer slides in. The drawer and its content are animated."expand"
The drawer expands from the closed position. The drawer's width is animated; its content is not.
When you change the Drawer's reveal mode, the component needs to perform recalculations for animation. As a result, the template is rerendered which can increase loading time.
See Also
rtlEnabled
When this property is set to true, the UI component text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.
- DevExpress.config({
- rtlEnabled: true
- });
template
This property specifies the drawer's content. To specify the view's content, nest it inside the Drawer's markup element as shown in the code below.
- $(function() {
- $("#drawerContainer").dxDrawer({
- template: function() {
- const $drawerContent = $("<div>").width(200);
- // ...
- // Specify the drawer's content here
- // ...
- return $drawerContent;
- }
- });
- });
- <div id="drawerContainer">
- <!-- Declare the view's content here -->
- </div>
See Also
width
This property accepts a value of one of the following types:
Number
The width in pixels.String
A CSS-accepted measurement of width. For example,"55px"
,"20vw"
,"auto"
,"inherit"
. If you want to specify relative width, use thevw
width measurements.Function (deprecated since v21.2)
Refer to the W0017 warning description for information on how you can migrate to viewport units.
If you have technical questions, please create a support ticket in the DevExpress Support Center.