Vue Form - Item Properties

To change an item property at runtime, bind the property that should be changed to a component property:

App.vue
  • <template>
  • <div>
  • <DxForm :form-data="employee">
  • <DxSimpleItem data-field="firstName" />
  • <DxSimpleItem data-field="lastName" />
  • <DxGroupItem caption="Contacts">
  • <DxSimpleItem data-field="phone" :visible="isPhoneVisible" />
  • <DxSimpleItem data-field="email" />
  • </DxGroupItem>
  • </DxForm>
  • <DxCheckBox
  • text="Show the Phone Number"
  • v-model:value="isPhoneVisible" />
  • </div>
  • </template>
  • <script>
  • import 'devextreme/dist/css/dx.fluent.blue.light.css';
  •  
  • import { DxForm, DxSimpleItem, DxGroupItem } from 'devextreme-vue/form';
  • import { DxCheckBox } from 'devextreme-vue/check-box';
  •  
  • const employee = {
  • firstName: 'John',
  • lastName: 'Heart',
  • phone: '+1(213) 555-9392',
  • email: 'jheart@dx-email.com'
  • };
  •  
  • export default {
  • components: {
  • DxForm, DxSimpleItem, DxGroupItem, DxCheckBox
  • },
  • data() {
  • return {
  • employee,
  • isPhoneVisible: true
  • };
  • },
  • };
  • </script>

When you modify an item, the Form also refreshes all other items in its group. If an item is not in a group, the whole Form is refreshed. To update only your chosen items, wrap them into a separate group.

NOTE
When you call this method, Form rerenders the layout. As a result, all editors are re-initialized and their settings return to the initial editorOptions configuration.
See Also