$(() => {
const passwordEditor = $('#password').dxTextBox({
placeholder: 'password',
mode: 'password',
value: 'password',
stylingMode: 'filled',
buttons: [{
name: 'password',
location: 'after',
options: {
icon: '../../../../images/icons/eye.png',
type: 'default',
onClick() {
passwordEditor.option('mode', passwordEditor.option('mode') === 'text' ? 'password' : 'text');
},
},
}],
}).dxTextBox('instance');
const currencyEditor = $('#multicurrency').dxNumberBox({
value: 14500.55,
format: '$ #.##',
showClearButton: true,
showSpinButtons: true,
buttons: [{
name: 'currency',
location: 'after',
options: {
text: '€',
stylingMode: 'text',
width: 32,
elementAttr: {
class: 'currency',
},
onClick(e) {
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);
}
},
},
}, 'clear', 'spins'],
}).dxNumberBox('instance');
const millisecondsInDay = 24 * 60 * 60 * 1000;
const dateEditor = $('#advanced-datebox').dxDateBox({
value: new Date().getTime(),
stylingMode: 'outlined',
buttons: [{
name: 'today',
location: 'before',
options: {
text: 'Today',
onClick() {
dateEditor.option('value', new Date().getTime());
},
},
}, {
name: 'prevDate',
location: 'before',
options: {
icon: 'spinprev',
stylingMode: 'text',
onClick() {
const currentDate = dateEditor.option('value');
dateEditor.option('value', currentDate - millisecondsInDay);
},
},
}, {
name: 'nextDate',
location: 'after',
options: {
icon: 'spinnext',
stylingMode: 'text',
onClick() {
const currentDate = dateEditor.option('value');
dateEditor.option('value', currentDate + millisecondsInDay);
},
},
}, 'dropDown'],
}).dxDateBox('instance');
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script>
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/22.2.6/css/dx.light.css" />
<script src="https://cdn3.devexpress.com/jslib/22.2.6/js/dx.all.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script src="index.js"></script>
</head>
<body class="dx-viewport">
<div class="demo-container">
<div class="dx-fieldset">
<div class="dx-field">
<div class="dx-field-label">Password TextBox</div>
<div class="dx-field-value">
<div id="password"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Multi-currency NumberBox</div>
<div class="dx-field-value">
<div id="multicurrency"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Advanced DateBox</div>
<div class="dx-field-value">
<div id="advanced-datebox"></div>
</div>
</div>
</div>
</div>
</body>
</html>
.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;
}