I'm having a problem with the fields. When I change the field value, the record value is no longer updated.
When you click the button the message shows only the value of the updated field, but the record value has not been modified.
If you click the "Clear Error" button, and modify the field, the message shows both the same.
class Person extends Model {
static get fields() {
return [
{ name: "id", type: "string" },
{ name: "Order", type: "model" },
{ name: "Name", type: "string" }
];
}
}
let myPerson = new Person();
myPerson.Name = "My name";
let myField = new TextField({
appendTo : document.body,
width : 200,
label : 'Enter text',
name : 'Name',
style : 'margin-right: .5em'
});
let myButton = new Button({
text: 'My button',
onClick: function ()
{
Toast.show("Field value: " + myField.value);
Toast.show("Record value: " + myPerson.Name);
}
});
let myButton2 = new Button({
text: 'Clear button',
onClick: function ()
{
myField.clearError();
}
});
let MyContainer = new Container({
appendTo : document.body,
autoUpdateRecord: true,
items: [myField, myButton, myButton2]
})
MyContainer.record = myPerson;
myField.setError("My error");