-
Data Grid
- Overview
-
Data Binding
-
Paging and Scrolling
-
Editing
-
Grouping
-
Filtering and Sorting
- Focused Row
-
Row Drag & Drop
-
Selection
-
Columns
- State Persistence
-
Appearance
-
Templates
-
Data Summaries
-
Master-Detail
-
Export to PDF
-
Export to Excel
-
Adaptability
- Keyboard Navigation
-
Pivot Grid
- Overview
-
Data Binding
-
Field Chooser
-
Features
-
Export to Excel
-
Tree List
- Overview
-
Data Binding
- Sorting
- Paging
-
Editing
- Node Drag & Drop
- Focused Row
-
Selection
-
Filtering
-
Column Customization
- State Persistence
- Adaptability
- Keyboard Navigation
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Features
- Virtual Scrolling
-
Grouping
-
Customization
- Adaptability
-
Html Editor
-
Chat
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
Charts
- Overview
-
Data Binding
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Line Charts
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
-
Sparkline Charts
-
Tree Map
-
Funnel and Pyramid Charts
- Sankey Chart
-
Combinations
-
More Features
-
Export
-
Selection
-
Tooltips
-
Zooming
-
-
Gantt
- Overview
-
Data
-
UI Customization
- Strip Lines
- Export to PDF
- Sorting
-
Filtering
-
Gauges
- Overview
-
Data Binding
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Navigation
- Overview
- Accordion
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
- Pagination
-
Tree View
- Right-to-Left Support
-
Layout
-
Tile View
- Splitter
-
Gallery
- Scroll View
- Resizable
-
-
Editors
- Overview
- Autocomplete
-
Calendar
- Check Box
- Color Box
- Date Box
-
Date Range Box
-
Drop Down Box
-
Number Box
-
Select Box
- Switch
-
Tag Box
- Text Area
- Text Box
- Validation
- Custom Text Editor Buttons
- Right-to-Left Support
- Editor Appearance Variants
-
Forms and Multi-Purpose
- Overview
- Button Group
- Field Set
-
Filter Builder
-
Form
- Radio Group
-
Range Selector
- Numeric Scale (Lightweight)
- Numeric Scale
- Date-Time Scale (Lightweight)
- Date-Time Scale
- Logarithmic Scale
- Discrete scale
- Custom Formatting
- Use Range Selection for Calculation
- Use Range Selection for Filtering
- Image on Background
- Chart on Background
- Customized Chart on Background
- Chart on Background with Series Template
- Range Slider
- Slider
-
Sortable
-
File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Actions and Lists
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
Floating Action Button
The Floating Action Button (FAB) is the primary action button on a screen that is displayed in front of all screen content. The FAB can perform an action or open a stack of two to five related actions (speed dial).
This demo illustrates a FAB that opens a speed dial when there are selected grid rows or performs a custom action—adds a new row—when nothing is selected.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
@(Html.DevExtreme().DataGrid<DevExtreme.MVC.Demos.Models.DataGrid.Employee>()
.ID("grid")
.DataSource(d => d.WebApi()
.Controller("DataGridEmployees")
.InsertAction(true)
.UpdateAction(true)
.DeleteAction(true)
.Key("ID")
)
.Selection(s => s.Mode(SelectionMode.Single))
.Paging(paging => paging.Enabled(false))
.Editing(e => e.Mode(GridEditMode.Popup)
.Popup(p => p
.Width(600)
.Height(400)
.Position(pos => pos
.My(HorizontalAlignment.Center, VerticalAlignment.Center)
.At(HorizontalAlignment.Center, VerticalAlignment.Center)
.Of("#grid")
)
)
.Texts(t => t
.ConfirmDeleteMessage("")
)
)
.ShowBorders(true)
.Columns(columns => {
columns.Add()
.DataField("Prefix")
.Caption("Title");
columns.Add().DataField("FirstName");
columns.Add().DataField("LastName");
columns.Add()
.DataField("Position")
.Width(130);
columns.Add()
.DataField("StateID")
.Caption("State")
.Width(125)
.Lookup(lookup => lookup
.DataSource(d => d.WebApi().Controller("DataGridStatesLookup").LoadAction("Get").Key("ID"))
.DisplayExpr("Name")
.ValueExpr("ID")
);
columns.Add()
.DataField("BirthDate")
.DataType(GridColumnDataType.Date)
.Width(125);
})
.OnSelectionChanged("selectionChanged")
)
@(Html.DevExtreme().SpeedDialAction()
.ID("action-add")
.Icon("add")
.Label("Add row")
.Index(1)
.OnClick("addRow")
)
@(Html.DevExtreme().SpeedDialAction()
.ID("action-remove")
.Icon("trash")
.Visible(false)
.Label("Delete row")
.Index(2)
.OnClick("deleteRow")
)
@(Html.DevExtreme().SpeedDialAction()
.ID("action-edit")
.Icon("edit")
.Visible(false)
.Label("Edit row")
.Index(3)
.OnClick("editRow")
)
<div id="action-remove"></div>
<div id="action-edit"></div>
<div class="options">
<div class="caption">Options</div>
<div class="option">
<span>Direction:</span>
@(Html.DevExtreme().SelectBox()
.DataSource(new JS("['auto', 'up', 'down']"))
.Value("auto")
.InputAttr("aria-label", "Direction")
.OnSelectionChanged("directionChanged")
)
</div>
</div>
<script>
var directions = {
"auto": {
icon: "rowfield",
shading: true,
position: {
of: "#grid",
my: "right bottom",
at: "right bottom",
offset: "-16 -16"
}
},
"up": {
icon: "rowfield",
shading: true,
direction: "up",
position: {
of: "#grid",
my: "right bottom",
at: "right bottom",
offset: "-16 -16"
}
},
"down": {
icon: "rowfield",
shading: true,
direction: "down",
position: {
of: ".dx-datagrid-rowsview",
my: "right top",
at: "right top",
offset: "-16 16"
}
}
};
var selectedRowIndex = -1;
var selectionChanged = function (e) {
selectedRowIndex = e.component.getRowIndexByKey(e.selectedRowKeys[0]);
$("#action-remove").dxSpeedDialAction("instance").option("visible", selectedRowIndex !== -1);
$("#action-edit").dxSpeedDialAction("instance").option("visible", selectedRowIndex !== -1);
}
var getGridInstance = function() {
return $("#grid").dxDataGrid("instance");
}
var addRow = function () {
getGridInstance().addRow();
getGridInstance().deselectAll();
}
var deleteRow = function () {
getGridInstance().deleteRow(selectedRowIndex);
getGridInstance().deselectAll();
}
var editRow = function () {
getGridInstance().editRow(selectedRowIndex);
getGridInstance().deselectAll();
}
var directionChanged = function(e) {
DevExpress.config({
floatingActionButtonConfig: directions[e.selectedItem]
});
DevExpress.ui.repaintFloatingActionButton();
}
</script>
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
In DevExtreme, the FAB is implemented as a container that collects and stores SpeedDialAction components. To display a FAB that performs a custom action, add a SpeedDialAction to the page. Specify its onClick and icon properties. Setting other properties is not required.
Two to five SpeedDialActions are collected in the FAB's speed dial. The actions are sorted according to their indexes. To hide an action from the speed dial, set its visible property to false.
FAB parameters are configured in the floatingActionButtonConfig object. Use it to change the FAB's position, maximum number of actions, icons in the open and close states, and other parameters. In this demo, the drop-down menu under the grid allows you to select the direction in which the speed dial should be opened. The repaintFloatingActionButton() method is called to apply the new configuration.
To get started with DevExtreme Floating Action Button, refer to the following tutorial for step-by-step instructions: Getting Started with Floating Action Button.