-
Data Grids / Data Management
-
Data Grid
- Overview
-
Data Binding
-
Filtering
- Sorting
-
Editing
-
Grouping
-
Selection
- Focused Row
- Paging
-
Scrolling
-
Columns
-
Master-Detail
-
Data Summaries
-
Drag & Drop
-
Export to PDF
-
Export to Excel
- Appearance
-
Customization
- State Persistence
-
Adaptability
-
Keyboard Navigation
- Right-To-Left Support
-
Tree List
- Overview
-
Data Binding
-
Filtering
- Sorting
-
Editing
-
Selection
- Focused Row
- Paging
-
Columns
- Drag & Drop
- State Persistence
- Adaptability
-
Keyboard Navigation
-
Card View
-
Pivot Grid
- Overview
-
Data Binding
-
Field Management
-
Data Summaries
- Drill Down
- Filtering
-
Scrolling
-
Export to Excel
- Chart Integration
- Customization
- State Persistence
-
Filter Builder
-
-
Data Visualization
-
Charts
- Overview
-
Data Binding
-
Common Concepts
-
Axis
-
Aggregation
-
Tooltips
-
Selection
-
Customization
-
Zooming
-
Export
-
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Funnel and Pyramid Charts
-
Line Charts
- Pareto Chart
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
- Sankey Chart
-
Sparkline Charts
-
Tree Map
-
Gauges
- Overview
-
Runtime update
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
-
Scheduling / Planning
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Appointments
-
Timetable
- Editing
-
Grouping
- Virtual Scrolling
- Drag & Drop
-
Customization
- Adaptability
-
Gantt
- Overview
- Data Binding
-
Filtering
- Sorting
- Strip Lines
- Export to PDF
- Validation
-
Customization
-
-
Reporting
-
AI-powered Extensions
-
Interaction
-
Report Types
-
Data binding
-
Real-life Reports
-
Layout Features
-
Report Controls
-
Web-specific Features
-
-
Rich Text Editor
- Overview
- Load/Save
- Document Protection
-
Templates
- Autocorrect
-
Customization
- Simple View
-
Spreadsheet
- Overview
-
Open a Document
- Export And Printing
-
Features
-
UI Customization
-
Messaging
-
WYSIWYG Editor
-
Forms
-
Data Editors
- Overview
-
Common Concepts
-
Calendar
- Check Box
- Color Box
- Date Box
-
Date Range Box
-
Number Box
- Radio Group
-
Range Selector
- Range Slider
- Slider
- Switch
- Text Area
- Text Box
-
Drop-Downs
- Autocomplete
-
Drop Down Box
-
Select Box
-
Tag Box
-
Lookup
-
Buttons
-
File Upload / File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Popup and Notifications
-
Navigation
- Overview
- Accordion
-
Context Menu
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
-
Stepper
- Pagination
-
List
-
Tree View
- Right-to-Left Support
-
Layout
-
Tile View
- Splitter
-
Gallery
- Scroll View
-
-
Interactive Wrappers
-
Sortable
- Resizable
-
-
Progress Indicators
-
Maps
- Overview
-
Map
-
Vector Map
-
Data Binding
- Multiple Layers
-
Markers
- Legend
-
Zooming and Panning
-
Customization
-
-
Localization
Related Demos:
Your search did not match any results.
Data Editors - Custom Text Editor Buttons
Text editors have built-in action buttons that allow users to open a drop-down menu, increase, decrease, or nullify the value, and perform other actions. To add custom action buttons for different scenarios, use the buttons[] array.
Backend API
<div class="dx-fieldset">
<div class="dx-field">
<div class="dx-field-label">Password TextBox</div>
<div class="dx-field-value">
@(Html.DevExtreme().TextBox()
.ID("password")
.Value("password")
.InputAttr("aria-label", "Password")
.Placeholder("password")
.Mode(TextBoxMode.Password)
.StylingMode(EditorStylingMode.Filled)
.Buttons(buttons => {
buttons.Add()
.Name("password")
.Location(TextEditorButtonLocation.After)
.Widget(w => w.Button()
.StylingMode(ButtonStylingMode.Text)
.Icon("eyeopen")
.OnClick("changePasswordMode"));
})
)
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Multi-currency NumberBox</div>
<div class="dx-field-value">
@(Html.DevExtreme().NumberBox()
.ID("multicurrency")
.Value(14500.55)
.Format("$ #.##")
.ShowClearButton(true)
.InputAttr("aria-label", "Multi Currency")
.ShowSpinButtons(true)
.Buttons(buttons => {
buttons.Add()
.Name("currency")
.Location(TextEditorButtonLocation.After)
.Widget(w => w.Button()
.Text("€")
.StylingMode(ButtonStylingMode.Text)
.Width(32)
.ElementAttr("class", "currency")
.OnClick("changeCurrency"));
buttons.Add()
.Name("clear");
buttons.Add()
.Name("spins");
})
)
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Advanced DateBox</div>
<div class="dx-field-value">
@(Html.DevExtreme().DateBox()
.ID("advanced-datebox")
.InputAttr("aria-label", "Date")
.Value(new JS("new Date().getTime()"))
.StylingMode(EditorStylingMode.Outlined)
.OnInitialized("dateOnInitialized")
.Buttons(buttons => {
buttons.Add()
.Name("today")
.Location(TextEditorButtonLocation.Before)
.Widget(w => w.Button()
.Text("Today")
.StylingMode(ButtonStylingMode.Text)
.OnClick("today"));
buttons.Add()
.Name("prevDate")
.Location(TextEditorButtonLocation.Before)
.Widget(w => w.Button()
.Icon("spinprev")
.StylingMode(ButtonStylingMode.Text)
.OnClick("prevDate"));
buttons.Add()
.Name("nextDate")
.Location(TextEditorButtonLocation.After)
.Widget(w => w.Button()
.Icon("spinnext")
.StylingMode(ButtonStylingMode.Text)
.OnClick("nextDate"));
buttons.Add()
.Name("dropDown");
})
)
</div>
</div>
</div>
<script>
var millisecondsInDay = 24 * 60 * 60 * 1000;
function changePasswordMode() {
var passwordEditor = $("#password").dxTextBox("instance");
passwordEditor.option("mode", passwordEditor.option("mode") === "text" ? "password" : "text");
}
function changeCurrency(e) {
var currencyEditor = $("#multicurrency").dxNumberBox("instance");
if(e.component.option("text") === "$") {
e.component.option("text", "€");
currencyEditor.option("format", "$ #.##");
currencyEditor.option("value", currencyEditor.option("value") / 0.836);
} else {
e.component.option("text", "$");
currencyEditor.option("format", "€ #.##");
currencyEditor.option("value", currencyEditor.option("value") * 0.836);
}
}
var dateEditor;
function dateOnInitialized(e) {
dateEditor = e.component;
}
function today() {
dateEditor.option("value", new Date().getTime());
}
function prevDate() {
dateEditor.option("value", dateEditor.option("value") - millisecondsInDay);
}
function nextDate() {
dateEditor.option("value", dateEditor.option("value") + millisecondsInDay);
}
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using DevExtreme.AspNet.Mvc;
using DevExtreme.AspNet.Data;
using DevExtreme.NETCore.Demos.Models;
using DevExtreme.NETCore.Demos.Models.SampleData;
using DevExtreme.NETCore.Demos.ViewModels;
using DevExtreme.NETCore.Demos.Models.DataGrid;
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace DevExtreme.NETCore.Demos.Controllers {
public class CommonController : Controller {
public ActionResult CustomTextEditorButtons() {
return View();
}
}
}
.dx-fieldset {
min-height: 560px;
width: 560px;
margin: 0 auto;
}
.currency {
min-width: 32px;
}
.dx-button.currency .dx-button-content {
font-size: 120%;
padding-left: 5px;
padding-right: 5px;
}
Each object in the buttons[] array should have the name field—the button's identifier. In addition, specify the button's location relative to the input text field and options of the Button component used as the action button.
The buttons[] array also accepts string values—the names of built-in buttons. Declare them in the order the buttons should have in the component. String and object declarations can be used in the same array.