I build a form and added to items a button with a function.
When I click a button of item I need to update the value of the other item.
So I have this scenario:
$("#form").dxForm({
…
items: [
{
itemType: "group",
items: [
{
dataField: "zero",
editorType: "dxTextBox",
template: function(data, itemElement) {
if (data.editorType=='dxTextBox') {
$('<div id="' + data.dataField + '_ext" style="float:left">').
appendTo(itemElement).dxTextBox({
readOnly: data.editorOptions.readOnly,
value: data.editorOptions.value,
onValueChanged: function (e) {
data.component.option('formData.' + data.dataField, e.value);
}
});
$('<div style="float:left; width:39px; margin-left:1px;">').
appendTo(itemElement).dxButton({
icon: "arrowright",
text: '',
stylingMode: "text",
visible: !data.editorOptions.readOnly,
onClick: function (e) {
var result = DevExpress.ui.dialog.confirm("Are you sure?", "Confirm");
result.done(function (dialogResult) {
if (dialogResult) {
copyTo(data.editorOptions.value, "to");
}
}
}
}
},
{
dataField: "uno",
editorType: "dxTextBox",
template: function(data, itemElement) {
if (data.editorType=='dxTextBox') {
$('<div id="' + data.dataField + '_ext" style="float:left">').
appendTo(itemElement).dxTextBox({
readOnly: data.editorOptions.readOnly,
value: data.editorOptions.value,
onValueChanged: function (e) {
data.component.option('formData.' + data.dataField, e.value);
}
});
$('<div style="float:left; width:39px; margin-left:1px;">').
appendTo(itemElement).dxButton({
icon: "arrowright",
text: '',
stylingMode: "text",
visible: !data.editorOptions.readOnly,
onClick: function (e) {
var result = DevExpress.ui.dialog.confirm("Are you sure?", "Confirm");
result.done(function (dialogResult) {
if (dialogResult) {
copyTo(data.editorOptions.value, "zero");
}
}
}
}
}
]
}
});
function copyTo(value, field)
{
var form = $("#form").dxForm("instance");
var editor = form.getEditor(field).
editor.option("value",value);
}
but I receive editor is undefined
What's wrong?
Hello Antonio,
Your Universal Subscription expired on May 2018. Our support service is not available to customers with expired subscriptions but sometimes may be granted based on support load. I recommend that you consider renewing your subscription.