Edit types in Vue Grid component

9 Nov 202424 minutes to read

The Vue Grid component in Syncfusion provides various edit types that allow you to customize the editing behavior for different types of columns. These edit types enhance the editing experience and provide flexibility in handling different data types.

Default cell edit type editor

The Syncfusion Grid provides pre-built default editors that enhance data editing and input handling within the grid. These default editors are designed to simplify the process of defining the editor component for specific columns based on the data type of the column within the grid. To configure default editors for grid columns, leverage the editType property.

The available default edit types are as follows:

Component Edit Type value Description
TextBox stringedit The stringedit type renders a TextBox component for string data type columns.
NumericTextBox numericedit The numericedit type renders a NumericTextBox component for integers,double,float ,short ,byte ,long ,long double and decimal data types columns.
DropDownList dropdownedit The dropdownedit type renders a DropdownList component for string data type columns.
Checkbox booleanedit The booleanedit type renders a CheckBox component for boolean data type columns.
DatePicker datepickeredit The datepickeredit type renders a DatePicker component for date data type columns.
DateTimePicker datetimepickeredit The datetimepickeredit type renders a DateTimePicker component for date time data type columns.

The following example demonstrates how to define the editType for grid columns:

    <e-column field="CustomerName" headerText="Customer Name" editType="stringedit"></e-column>
    <e-column field="Frieght" headerText="Frieght" editType="numericedit'"></e-column>
    <e-column field="ShipCountry" headerText="Ship Country" editType="dropdownedit"></e-column>
    <e-column field="OrderDate" headerText="Order Date" editType="datepickeredit"></e-column>
    <e-column field="OrderTime" headerText="Order Time" editType="datetimepickeredit"></e-column>
    <e-column field="Verified" headerText="Verified" editType="booleanedit"></e-column>

If edit type is not defined in the column, then it will be considered as the stringedit type (TextBox component) .

Customize TextBox component of stringedit type

You can customize the default TextBox component in Grid edit form using its property. This customization allows you to configure various properties of the TexBox, tailoring its behavior and appearance to match your specific requirements within the Grid. The behavior of the editor component can be fine-tuned through the columns->edit->params property.

Component Edit Type Description Example Customized edit params
TextBox stringedit The stringedit type renders a TextBox component for string data type columns. To customize the TextBox component, refer to the TextBox API documentation for detailed information on available properties params: { showClearButton : true}

The following sample code demonstrates the customization applied to TextBox component of CustomerID Grid column:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' :edit='stringParams' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' textAlign='Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :validationRules='shipCityRules' width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide } from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const dataGrid=data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules= { required: true };
const shipCityRules= { required: true };
const stringParams ={
            params: {
                showClearButton: true
            }
        }
provide('grid', [Edit, Toolbar],);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' :edit='stringParams' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' textAlign='Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :validationRules='shipCityRules' width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: {
        allowEditing: true,
        allowAdding: true,
        allowDeleting: true,
      },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      stringParams: {
        params: {
          showClearButton: true,
        },
      },
    };
  },

  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  },
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Customize NumericTextBox component of numericedit type

You can customize the NumericTextBox component in Grid edit form using its property. This customization allows you to configure various properties of the NumericTextBox, tailoring its behavior and appearance to match your specific requirements within the Grid. The behavior of the editor component can be fine-tuned through the columns->edit->params property.

Component Edit Type Description Example Customized edit params
NumericTextBox numericedit TThe numericedit type renders a NumericTextBox component for integers, double, float, short, byte, long, long double and decimal data types columns. To customize the NumericTextBox component, refer to the NumericTextBox API documentation for detailed information on available properties. params: { decimals: 2, value: 5 }

The following sample code demonstrates the customization applied to NumericTextBox component of Frieght Grid column:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' :edit ='numericParams' headerText='Freight' textAlign= 'Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType= 'dropdownedit' :validationRules='shipCityRules' width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide } from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const dataGrid=data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules= { required: true };
const shipCityRules= { required: true };
const numericParams = {
        params: {
          decimals: 0,
          format: 'N',
          showClearButton: true,
          showSpinButton: false
        }
      }
provide('grid', [Page, Edit, Toolbar],);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' :edit ='numericParams' headerText='Freight' textAlign= 'Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType= 'dropdownedit' :validationRules='shipCityRules' width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      numericParams : {
            params: {
                decimals: 0,
                format: 'N',
                showClearButton: true,
                showSpinButton: false
            }
        }
    };
  },

  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  },
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Restrict to type decimal points in a NumericTextBox while editing the numeric column

By default, the NumericTextBox component allows entering decimal values with up to two decimal places when editing a numeric column. However, there might be cases where you want to restrict input to whole numbers only, without any decimal points. In such scenarios, you can make use of the validateDecimalOnType and decimals properties provided by Syncfusion’s NumericTextBox component.

The validateDecimalOnType property is used to control whether decimal points are allowed during input in the NumericTextBox. By default, it is set to false, allowing decimal points to be entered. However, when set to true, decimal points will be restricted, and only whole numbers can be entered.

The decimals property specifies the number of decimal places to be displayed in the NumericTextBox. By default, it is set to 2, meaning that two decimal places will be displayed. However, you can modify this value to customize the decimal places according to your requirements.

In the below demo, while editing the row the decimal point value is restricted to type in the NumericTextBox of Freight column.

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' :edit ='numericParams' headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules'  width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType= 'dropdownedit'  :validationRules='shipCityRules'   width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script setup>
import { provide } from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const dataGrid=data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules= { required: true };
const shipCityRules= { required: true };
const numericParams = {
        params: {
          validateDecimalOnType: true,
          decimals: 0,
          format: 'N'
        }
      }
provide('grid', [Edit, Toolbar],);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' :edit ='numericParams' headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules'  width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType= 'dropdownedit'  :validationRules='shipCityRules'   width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      numericParams : {
            params: {
              validateDecimalOnType: true,
              decimals: 0,
              format: 'N'
            }
        }
    };
  },

  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Customize DropDownList component of DropDownEdit type

You can customize the DropDownList component in Grid edit form using its property. This customization allows you to configure various properties of the DropDownList, tailoring its behavior and appearance to match your specific requirements within the Grid. The behavior of the editor component can be fine-tuned through the columns->edit->params property.

Component Edit Type Description Example Customized edit params
DropDownList- DropDownEdit The dropdownedit type renders a DropDownList component for string data type columns. To customize the DropDownList component, refer to the DropDownList API documentation for detailed information on available properties. params: { value: ‘Germany’ }

The following sample code demonstrates the customization applied to DropDownList component of ShipCity Grid column:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign='Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :edit='dropDownParams' :validationRules='shipCityRules' width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide } from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const dataGrid=data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules= { required: true };
const shipCityRules= { required: true };
const dropDownParams ={
  params: {
    showClearButton: true,
    popupHeight: 120
  }
}
provide('grid', [Page, Edit, Toolbar],);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign='Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :edit='dropDownParams' :validationRules='shipCityRules' width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: {
        allowEditing: true,
        allowAdding: true,
        allowDeleting: true,
      },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      dropDownParams: {
        params: {
          showClearButton: true,
          popupHeight: 120,
        },
      },
    };
  },

  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  },
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Provide custom data source for DropDownList component

In Syncfusion’s Grid component, you have an option to provide a custom data source for the DropDownList component in the edit form. This feature allows you to define a specific set of values for the DropDownList.

To achieve this, you can utilize the columns->edit->params property. This property allows you to define the edit params for the column within the grid.

When setting a new data source using the edit params, you need to specify a new query property for the DropDownList. The query property allows you to define custom queries for data retrieval and filtering.

In the below demo, DropDownList is rendered with custom data source for the ShipCountry column :

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules'  width=120></e-column>
        <e-column field='ShipCountry' headerText='Ship Country'  editType= 'dropdownedit' :edit='dropDownParams' :validationRules='countryRules'   width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script setup>
import { provide } from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { Query, DataManager } from '@syncfusion/ej2-data';

const dataGrid = data;
const country = [
  { countryName: "United States", countryId: "1" },
  { countryName: "Australia", countryId: "2" },
  { countryName: "India", countryId: "3" },
];
const editSettings = {
  allowEditing: true,
  allowAdding: true,
  allowDeleting: true,
};
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules = { required: true, number: true };
const freightRules = { required: true, min: 1, max: 1000 };
const customerIDRules = { required: true };
const countryRules = { required: true };
const dropDownParams = {
  params: {
    dataSource: new DataManager(country),
    fields: { text: "countryName", value: "countryName" },
    query: new Query(),
    actionComplete: () => false,
  },
};
provide("grid", [Edit, Toolbar]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules'  width=120></e-column>
        <e-column field='ShipCountry' headerText='Ship Country'  editType= 'dropdownedit' :edit='dropDownParams' :validationRules='countryRules'   width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { Query, DataManager } from '@syncfusion/ej2-data';
import { data } from './datasource.js';
const country = [
  { countryName: "United States", countryId: "1" },
  { countryName: "Australia", countryId: "2" },
  { countryName: "India", countryId: "3" },
];
export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: {
        allowEditing: true,
        allowAdding: true,
        allowDeleting: true,
      },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      countryRules: { required: true },
      dropDownParams: {
        params: {
          dataSource: new DataManager(country),
          fields: { text: "countryName", value: "countryName" },
          query: new Query(),
          actionComplete: () => false,
        },
      },
    };
  },

  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  },
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Apply filtering for DropDownList component

The Syncfusion Grid component provides filtering for the DropDownList within the edit form. This feature allows to select options from a predefined list and easily search for specific items using the built-in filtering feature.

To enable filtering, set the allowFiltering property to true within the edit params. This will enable the filtering feature in the DropDownList.

In the following demo, filtering is enabled for the ShipCountry column:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules'  width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType= 'dropdownedit' :edit='dropDownParams' :validationRules='shipCityRules'   width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script setup>
import { provide} from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const dataGrid=data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules= { required: true };
const shipCityRules= { required: true };
const dropDownParams ={
  params: {
   allowFiltering: true
  }
}
provide('grid', [Edit, Toolbar],);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules'  width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType= 'dropdownedit' :edit='dropDownParams' :validationRules='shipCityRules'   width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: {
        allowEditing: true,
        allowAdding: true,
        allowDeleting: true,
      },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      dropDownParams: {
        params: {
          allowFiltering: true,
        },
      },
    };
  },

  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  },
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Open popup while focusing in the edit cell

You can open the dropdown edit popup with a single click by focusing the dropdown element. This feature allows you to quickly access and interact with the dropdown options without the need for an additional click.

To achieve this, you can utilize the showPopup method provided by the EJ2 DropDownList component. This method can be invoked within the actionComplete event of the Grid, which triggers when an action, such as editing, is completed. By calling the showPopup method in this event, you can open the popup for the dropdown edit.

To ensure that the dropdown column is the clicked edit target, you need to set a global flag variable in the mouseup event along with load event. This flag variable will be used to determine if the clicked element corresponds to the dropdown column.

The following sample demonstrates how to open the popup when focusing on the edit cell using the actionComplete and load events:

<template>
  <div id="app">
    <ejs-grid ref="grid" :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px' :load='load' :actionComplete='onActionComplete'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules'  width=120></e-column>
        <e-column field='ShipCountry' headerText='Ship Country'  editType= 'dropdownedit'  :validationRules='countryRules'   width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script setup>
import { provide, ref} from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const grid = ref(null);
const dataGrid = data;
const editSettings = {
  allowEditing: true,
  allowAdding: true,
  allowDeleting: true,
};
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules = { required: true, number: true };
const freightRules = { required: true, min: 1, max: 1000 };
const customerIDRules = { required: true };
const countryRules = { required: true };
const load = function () {
  grid.value.ej2Instances.element.addEventListener("mouseup", (e) => {
    if (e.target.classList.contains("e-rowcell")) {
      if (grid.value.ej2Instances.isEdit) {
        this.$refs.grid.ej2Instances.endEdit();
      }
      let rowInformation = grid.value.ej2Instances.getRowInfo(e.target);
      if (rowInformation && rowInformation.column && rowInformation.column.field === "ShipCountry") {
        this.isDropDown = true;
        grid.value.ej2Instances.selectRow(rowInformation.rowIndex);
        grid.value.ej2Instances.startEdit();
      }
    }
  });
};
const onActionComplete = function (args) {
  if (args.requestType === "beginEdit" && this.isDropDown) {
    this.isDropDown = false;
    let dropDownObj =
      args.form.querySelector(".e-dropdownlist")["ej2_instances"][0];
    dropDownObj.element.focus();
    dropDownObj.showPopup();
  }
};
provide("grid", [Edit, Toolbar]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid ref="grid" :dataSource='data' :editSettings='editSettings' :toolbar='toolbar' height='265px' :load='load' :actionComplete='onActionComplete'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules'  width=120></e-column>
        <e-column field='ShipCountry' headerText='Ship Country'  editType= 'dropdownedit'  :validationRules='countryRules'   width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      data: data,
      isDropDown: false,
      editSettings: {
        allowEditing: true,
        allowAdding: true,
        allowDeleting: true,
      },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      countryRules: { required: true },
    };
  },
  methods: {
    load() {
      this.$refs.grid.ej2Instances.element.addEventListener("mouseup", (e) => {
        if (e.target.classList.contains("e-rowcell")) {
          if (this.$refs.grid.ej2Instances.isEdit) {
            this.$refs.grid.ej2Instances.endEdit();
          }
          let rowInformation = this.$refs.grid.ej2Instances.getRowInfo(e.target);
          if (
            rowInformation &&
            rowInformation.column &&
            rowInformation.column.field === "ShipCountry"
          ) {
            this.isDropDown = true;
            this.$refs.grid.ej2Instances.selectRow(rowInformation.rowIndex);
            this.$refs.grid.ej2Instances.startEdit();
          }
        }
      });
    },
    onActionComplete(args) {
      if (args.requestType === "beginEdit" && this.isDropDown) {
        this.isDropDown = false;
        let dropDownObj =
          args.form.querySelector(".e-dropdownlist")["ej2_instances"][0];
        dropDownObj.element.focus();
        dropDownObj.showPopup();
      }
    },
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  },
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Customize CheckBox component of booleanedit type

You can customize the CheckBox component in Grid edit form using its property. This customization allows you to configure various properties of the CheckBox, tailoring its behavior and appearance to match your specific requirements within the Grid. The behavior of the editor component can be fine-tuned through the columns->edit->params property.

Component Edit Type Description Example Customized edit params
CheckBox booleanedit The booleanedit type renders a CheckBox component for boolean data type. To customize the CheckBox component, refer to the CheckBox API documentation for detailed information on available properties. params: { checked: true}

The following sample code demonstrates the customization applied to CheckBox component of Verified Grid column:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign= 'Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :validationRules='shipCityRules' width=150></e-column>
        <e-column field='Verified' headerText='Verified' width='100' :displayAsCheckBox='true' editType='booleanedit' :edit='booleanParams'></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide } from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const dataGrid=data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules= { required: true };
const shipCityRules= { required: true };
const booleanParams = {
   params: {
    disabled: true
  }
}
provide('grid', [Edit, Toolbar],);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID'  headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight'  headerText='Freight' textAlign= 'Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :validationRules='shipCityRules' width=150></e-column>
        <e-column field='Verified' headerText='Verified' width='100' :displayAsCheckBox='true' editType='booleanedit' :edit='booleanParams'></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      booleanParams : {
            params: {
                disabled: true
            }
        }
    };
  },

  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Customize DatePicker component of datepickeredit type

You can customize the DatePicker component in Grid edit form using its property. This customization allows you to configure various properties of the DatePicker, tailoring its behavior and appearance to match your specific requirements within the Grid. The behavior of the editor component can be fine-tuned through the columns->edit->params property.

Component Edit Type Description Example Customized edit params
DatePicker datepickeredit The datepickeredit type renders a DatePicker component for date data type columns. To customize the DatePicker component, refer to the DatePicker API documentation for detailed information on available properties. params: { format:’dd.MM.yyyy’ }

The following sample code demonstrates the customization applied to DatePicker component of OrderDate Grid column:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType= 'dropdownedit' :validationRules='shipCityRules' width=150></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="150" format='MM-dd-yyyy' editType= 'datepickeredit' :edit='datePickerParams' :validationRules='orderDateRules'></e-column>      
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide } from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const dataGrid=data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules= { required: true };
const shipCityRules= { required: true };
const datePickerParams = {
  params: {
    showClearButton: false,
    showTodayButton: false
  }
}
provide('grid', [Edit, Toolbar],);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' textAlign= 'Right' editType= 'numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType= 'dropdownedit' :validationRules='shipCityRules' width=150></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="150" format='MM-dd-yyyy' editType= 'datepickeredit' :edit='datePickerParams' :validationRules='orderDateRules'></e-column>      
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      orderDateRules: { required: true },
      datePickerParams : {
            params: {
                showClearButton: false,
                showTodayButton: false
            }
        }
    };
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Customize DateTimePicker component of datetimepickeredit type

You can customize the DateTimePicker component in Grid edit form using its property. This customization allows you to configure various properties of the DateTimePicker, tailoring its behavior and appearance to match your specific requirements within the Grid. The behavior of the editor component can be fine-tuned through the columns->edit->params property.

Component Edit Type Description Example Customized edit params
DateTimePicker datetimepickeredit The datetimepickeredit type renders a DateTimePicker component for date time data type columns. You can customize the DateTimePicker component, refer to the DateTimePicker API documentation for detailed information on available properties. params: { value: new Date() }

The following sample code demonstrates the customization applied to DatePicker component of OrderDate Grid column:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='400px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' textAlign='Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :validationRules='shipCityRules' width=150></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="150" format='MM-dd-yyyy hh mm aa' editType='datetimepickeredit' :edit='dateTimePickerParams' :validationRules='orderDateRules'></e-column>      
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide } from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const dataGrid=data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules= { required: true };
const shipCityRules= { required: true };
const orderDateRules= { required: true };
const dateTimePickerParams = { params: {
            showClearButton : false,
            format:'MM-dd-yyyy hh:mm aa',
            start:'Year',
           }
        }
provide('grid', [Edit, Toolbar],);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='400px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' textAlign='Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :validationRules='shipCityRules' width=150></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="150" format='MM-dd-yyyy hh mm aa' editType='datetimepickeredit' :edit='dateTimePickerParams' :validationRules='orderDateRules'></e-column>      
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      orderDateRules: { required: true },
      dateTimePickerParams : { params: {
            showClearButton : false,
            format:'MM-dd-yyyy hh:mm aa',
            start:'Year',
           }
        }
    };
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  },
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Access editor components using instance

Accessing editor components in the Syncfusion Grid allows you to interact with the editor instances associated with cells during editing or adding actions. This feature is especially useful when you need to perform custom actions, retrieve data from the Editor, or manipulate its properties during editing or adding operations in the Grid.

To access the component instance from the component element, you can use the ej2_instances property. This property provides access to the instance of the editor component associated with a cell.

In the below demo, you can access the editor component instance while adding or editing actions in the actionComplete event.

<template>
  <div id="app">
    <ejs-grid ref="grid" :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px' :actionComplete="onActionComplete">
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' textAlign='Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' editType='dropdownedit' :validationRules='countryRules' width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref} from "vue";
import { data } from './datasource.js';
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";

const grid=ref(null);
const dataGrid=data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules= { required: true };
const countryRules= { required: true };

const onActionComplete=function(args) {
    if (args.requestType === 'beginEdit' || args.requestType === 'add') {
      const tableRow = args.row;
      const numericTextBox = tableRow.querySelector('.e-numerictextbox');
      if (numericTextBox) {
        const numericTextBoxInstance = numericTextBox['ej2_instances'][0];
        numericTextBoxInstance.element.style.backgroundColor = 'light pink';
        numericTextBoxInstance.element.style.color = 'black';
        numericTextBoxInstance.element.style.border = '2px solid red';
        numericTextBoxInstance.element.style.textAlign = 'center';
        numericTextBoxInstance.max = 1000;
        numericTextBoxInstance.min = 1;
      }
      const dropDownList = tableRow.querySelector('.e-dropdownlist') ;
      if (dropDownList) {
        const dropDownListInstance = dropDownList['ej2_instances'][0];
        dropDownListInstance.showPopup();
      }
    }
}
provide('grid', [Page, Edit, Toolbar],);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid ref="grid" :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='265px' :actionComplete="onActionComplete">
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100 :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' textAlign='Right' editType='numericedit' :validationRules='freightRules' width=120></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' editType='dropdownedit' :validationRules='countryRules' width=150></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      countryRules: { required: true },
    };
  },
  methods:{
    onActionComplete:function(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        const tableRow = args.row;
        const numericTextBox = tableRow.querySelector('.e-numerictextbox');
        if (numericTextBox) {
          const numericTextBoxInstance = numericTextBox['ej2_instances'][0];
          numericTextBoxInstance.element.style.backgroundColor = 'light pink';
          numericTextBoxInstance.element.style.color = 'black';
          numericTextBoxInstance.element.style.border = '2px solid red';
          numericTextBoxInstance.element.style.textAlign = 'center';
          numericTextBoxInstance.max = 1000;
          numericTextBoxInstance.min = 1;
        }
        const dropDownList = tableRow.querySelector('.e-dropdownlist') ;
        if (dropDownList) {
          const dropDownListInstance = dropDownList['ej2_instances'][0];
          dropDownListInstance.showPopup();
        }
      }
    }
      },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Render custom cell editors

The Syncfusion Grid allows you to render custom cell editors for particular columns. This feature is particularly useful when you need to use custom components to edit the data within a grid column. To achieve this, you can make use of the editTemplate of the Grid Column component.

Custom components inside the editTemplate must be specified with two-way (@bind-Value) binding to reflect the changes in Grid.

Render TextArea in edit form

The Syncfusion Grid allows you to render a TextArea within the Grid’s edit form for a specific column. This feature is especially valuable when you need to edit and display multi-line text content, providing an efficient way to manage extensive text data within the Grid’s columns.

To render a TextArea in the edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

When using a text area, please use Shift+Enter to move to the next line. By default, pressing Enter will trigger a record update while you are in edit mode.

The following example demonstrates how to render a TextArea component in the ShipAdress column of the Syncfusion Grid. The valueAccessor property is utilized to split the text into multiple lines within the grid column:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipAddress' headerText='Ship Address' width='150' :editTemplate="'editTemplate'" :validationRules='shipAddressRules' :disableHtmlEncode=false :valueAccessor="valueAccessor">
          <template v-slot:editTemplate>
            <ejs-textbox id="ShipAddress" :multiline='true' :value="orderData.ShipAddress"></ejs-textbox>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref} from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { TextBoxComponent as EjsTextbox } from "@syncfusion/ej2-vue-inputs";
import { data } from './datasource.js';
const dataGrid= data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules={ required: true };
const shipAddressRules= { required: true };
const orderDateRules= { required: true };
let orderData=ref(null);
const valueAccessor=function(field, data) {
        const value = data.ShipAddress;
        return (value !== undefined) ? value.split('\n').join('<br>') : '';
    };
const actionBegin=function(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
           orderData.value = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        orderData.value['ShipAddress']=args.data['ShipAddress']
      }

};
  provide('grid',  [Edit, Toolbar]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipAddress' headerText='Ship Address' width='150' :editTemplate="'editTemplate'" :validationRules='shipAddressRules'  :disableHtmlEncode=false :valueAccessor="valueAccessor">
          <template v-slot:editTemplate>
            <ejs-textbox id="ShipAddress" :multiline='true' :value="orderData.ShipAddress"></ejs-textbox>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { TextBoxComponent } from "@syncfusion/ej2-vue-inputs";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    "ejs-textbox": TextBoxComponent
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipAddressRules: { required: true },
      orderDateRules: { required: true },
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['ShipAddress'] = args.data['ShipAddress'];
      }

    },
    valueAccessor (field, data) {
        const value = data.ShipAddress;
        return (value !== undefined) ? value.split('\n').join('<br>') : '';
    },
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Prevent the enter key functionality in multiline textbox while editing

While editing a particular row in normal or dialog edit mode, pressing the ENTER key will save the changes made in the specific cell or edit form. Similarly, pressing the ENTER key while performing editing with the multiline textbox will save the changes. However, in a multiline textbox, it is often desired that pressing the ENTER key adds a new line break in the text content, rather than triggering the save action.

To achieve this behavior, you can utilize the stopPropagation method along with the focus event of the textBox component. This prevents the default behavior of the ENTER key, allowing you to manually handle the newline behavior.

The following example demonstrates how to prevent the enter key functionality in multiline textbox during editing by utilizing the focus event:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipAddress' headerText='Ship Address' width='150' :editTemplate="'editTemplate'" :disableHtmlEncode=false  :valueAccessor="valueAccessor" >
          <template v-slot:editTemplate>
            <ejs-textarea id="ShipAddress" :multiline='true' :focus="onFocus" :value="orderData.ShipAddress"></ejs-textarea>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref} from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { TextAreaComponent as EjsTextarea } from '@syncfusion/ej2-vue-inputs';
import { data } from './datasource.js';
const dataGrid= data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules={ required: true };
const orderDateRules= { required: true };
let orderData=ref(null);

const actionBegin=function(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
           orderData.value = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        orderData.value['ShipAddress']=args.data['ShipAddress']
      }

};

const valueAccessor=function(field, data) {
        const value = data.ShipAddress;
        return (value !== undefined) ? value.split('\n').join('<br>') : '';
    };

const onFocus=function(args){
        args.event.target.addEventListener('keydown', (e) => {
            if (e.key === 'Enter') {
                e.stopPropagation();
            }
        });
  }
  provide('grid',  [ Edit, Toolbar]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipAddress' headerText='Ship Address' width='150' :editTemplate="'editTemplate'" :disableHtmlEncode=false  :valueAccessor="valueAccessor" >
          <template v-slot:editTemplate>
            <ejs-textarea id="ShipAddress" :multiline='true' :focus="onFocus" :value="orderData.ShipAddress"></ejs-textarea>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { TextAreaComponent } from '@syncfusion/ej2-vue-inputs';
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    "ejs-textarea": TextAreaComponent
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      orderDateRules: { required: true },
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['ShipAddress'] = args.data['ShipAddress'];
      }

    },

    valueAccessor (field, data) {
        const value = data.ShipAddress;
        return (value !== undefined) ? value.split('\n').join('<br>') : '';
    },

    onFocus(args){
        args.event.target.addEventListener('keydown', (e) => {
            if (e.key === 'Enter') {
                e.stopPropagation();
            }
        });
    }

  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Render AutoComplete component in edit form

The Syncfusion Grid allows you to render a AutoComplete component within the Grid’s edit form for a specific column. This feature is especially valuable when you need to provide a dropdown-like auto-suggestion and input assistance for data entry in the Grid’s columns.

To render a AutoComplete component in the edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

The following example demonstrates how to render an AutoComplete component in the CustomerID column of the Syncfusion Grid. The actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :editTemplate="'editTemplate'" :validationRules='customerIDRules'>
          <template v-slot:editTemplate>
            <ejs-autocomplete id="CustomerID" :value="orderData.CustomerID" :dataSource='autoCompleteData' :placeholder="'Select a customer'"></ejs-autocomplete>
          </template>
        </e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' width='130' type="date" editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='150' :validationRules='shipCountryRules'></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref} from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { AutoCompleteComponent as EjsAutocomplete } from "@syncfusion/ej2-vue-dropdowns";
import { data } from './datasource.js';
const dataGrid= data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules={ required: true };
const shipCountryRules= { required: true };
const orderDateRules= { required: true };
const autoCompleteData= [
        { value: 'VINET', text: 'VINET' },
        { value: 'TOMSP', text: 'TOMSP' },
        { value: 'HANAR', text: 'HANAR' },
        { value: 'VICTE', text: 'VICTE' },
        { value: 'SUPRD', text: 'SUPRD' },
      ];
let orderData = ref({});

const actionBegin = (args) => {
  if (args.requestType === 'beginEdit' || args.requestType === 'add') {
    orderData.value = Object.assign({}, args.rowData);
  }
  if (args.requestType === 'save') {
    orderData.value['CustomerID']= args.data['CustomerID'] ;
  }
};
  provide('grid',  [Edit, Toolbar]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :editTemplate="'editTemplate'" :validationRules='customerIDRules'>
          <template v-slot:editTemplate>
            <ejs-autocomplete id="CustomerID" :value="orderData.CustomerID" :dataSource='autoCompleteData' :placeholder="'Select a customer'"></ejs-autocomplete>
          </template>
        </e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' width='130' type="date" editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='150' :validationRules='shipCountryRules'></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { AutoCompleteComponent } from "@syncfusion/ej2-vue-dropdowns";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    'ejs-autocomplete': AutoCompleteComponent,
  },
  data() {
    return {
      dataGrid: data,
      autoCompleteData: [
        { value: 'VINET', text: 'VINET' },
        { value: 'TOMSP', text: 'TOMSP' },
        { value: 'HANAR', text: 'HANAR' },
        { value: 'VICTE', text: 'VICTE' },
        { value: 'SUPRD', text: 'SUPRD' },
      ],
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCountryRules: { required: true },
      orderDateRules: { required: true },
      orderData: {},
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['CustomerID']=args.data['CustomerID'] 
      }
    },
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Render MaskedTextBox component in edit form

The Syncfusion Grid allows you to render a MaskedTextBox component within the Grid’s edit form for a specific column. This feature is especially useful when you need to provide masked input fields that require a specific format, such as phone numbers or postal codes.

To render a MaskedTextBox component in the edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

Here’s an example of how to render a MaskedTextBox component in the CustomerNumber column of the Syncfusion Grid. The actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid ref="grid" :dataSource='dataGrid' :allowPaging='true' :editSettings='editSettings' :toolbar='toolbar' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules' width="100"></e-column>
        <e-column field='CustomerID' headerText='Customer ID' type='string' width="120" :validationRules='customerIDRules'></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width="100" :validationRules='shipCountryRules'></e-column>
        <e-column field='CustomerNumber' headerText='Customer Number' width="140" :editTemplate="'editTemplate'">
            <template v-slot:editTemplate>
              <ejs-maskedtextbox id="CustomerNumber" name="CustomerNumber" mask='000-000-0000' 
              :value="orderData.CustomerNumber"></ejs-maskedtextbox>
            </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref} from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { MaskedTextBoxComponent as EjsMaskedtextbox } from "@syncfusion/ej2-vue-inputs";
import { data } from './datasource.js';
const dataGrid= data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const customerIDRules={ required: true };
const shipCountryRules= { required: true };
let orderData=ref(null);

const actionBegin=function(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
         orderData.value = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        orderData.value['CustomerNumber']=args.data['CustomerNumber'] ;
      }
};
  provide('grid',  [Page, Edit, Toolbar]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid ref="grid" :dataSource='dataGrid'  :allowPaging='true' :editSettings='editSettings' :toolbar='toolbar' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules' width="100"></e-column>
        <e-column field='CustomerID' headerText='Customer ID' type='string' width="120" :validationRules='customerIDRules'></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width="100" :validationRules='shipCountryRules'></e-column>
        <e-column field='CustomerNumber' headerText='Customer Number' width="140" :editTemplate="'editTemplate'">
            <template v-slot:editTemplate>
              <ejs-maskedtextbox id="CustomerNumber" name="CustomerNumber" mask='000-000-0000' 
                         :value="orderData.CustomerNumber"></ejs-maskedtextbox>
            </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit,Page } from "@syncfusion/ej2-vue-grids";
import { MaskedTextBoxComponent } from "@syncfusion/ej2-vue-inputs";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    "ejs-maskedtextbox":MaskedTextBoxComponent
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      customerIDRules: { required: true },
      shipCountryRules: { required: true },
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['CustomerNumber'] = args.data['CustomerNumber'];
      }

    }
  },
  provide() {
    return {
      grid: [Edit, Toolbar,Page],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Render DropDownList component in edit form

The Syncfusion Grid allows you to render a DropDownList component within the Grid’s edit form for a specific column. This feature is valuable when you need to provide a convenient way to select options from a predefined list while editing data in the Grid’s edit form.

To render a DropDownList component in the edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

The following example demonstrates how to render a DropDownList component in the ShipCountry column of the Syncfusion Grid .The actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='150' :editTemplate="'editTemplate'"  :validationRules='shipCountryRules'>
          <template v-slot:editTemplate>
              <ejs-dropdownlist id="ShipCountry" :value='orderData.ShipCountry' :dataSource='selectDatasource' ></ejs-dropdownlist>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { DropDownListComponent as EjsDropdownlist } from "@syncfusion/ej2-vue-dropdowns";
import { data } from "./datasource.js";

const dataGrid = data;
const editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode: "Normal" };
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules = { required: true, number: true };
const freightRules = { required: true, min: 1, max: 1000 };
const customerIDRules = { required: true };
const shipCountryRules = { required: true };
const orderDateRules = { required: true };
const selectDatasource = [
  { value: "USA", text: "USA" },
  { value: "Canada", text: "Canada" },
  { value: "France", text: "France" },
  { value: "UK", text: "UK" },
  { value: "Germany", text: "Germany" },
];
let orderData = ref({});
const actionBegin = (args) => {
  if (args.requestType === "beginEdit" || args.requestType === "add") {
    orderData.value = { ...args.rowData };
  }
  if (args.requestType === "save") {
    orderData.value["ShipCountry"]=args.data["ShipCountry"] 
  }
};

provide("grid", [Edit, Toolbar]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='150' :editTemplate="'editTemplate'"  :validationRules='shipCountryRules'>
          <template v-slot:editTemplate>
              <ejs-dropdownlist id="ShipCountry" :dataSource='selectDatasource' :value='orderData.ShipCountry'></ejs-dropdownlist>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { DropDownListComponent } from "@syncfusion/ej2-vue-dropdowns";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    'ejs-dropdownlist' : DropDownListComponent,
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCountryRules: { required: true },
      orderDateRules: { required: true },
      selectDatasource : [
          { value: "USA", text: "USA" },
          { value: "Canada", text: "Canada" },
          { value: "France", text: "France" },
          { value: "UK", text: "UK" },
          { value: "Germany", text: "Germany" },
        ],
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['ShipCountry']=args.data['ShipCountry'] ;
      }

    }
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Render images in the DropDownList editor component using the item template

The Syncfusion Grid allows you to render images in the DropDownList editor component. This feature is valuable when you want to display images for each item in the dropdown list of a particular column, enhancing the visual representation of your data.

To render a DropDownList in the edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

To display an image in the DropDownList editor component, you can utilize the itemTemplate property. This property allows you to customize the content of each item in the dropdown list.

The following example demonstrates how to render images in the DropDownList editor component using the itemTemplate within the EmployeeName column of the Syncfusion Grid. Additionally, the actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid :dataSource="dataGrid" :editSettings="editSettings" :toolbar="toolbar" height="273px" :actionBegin="actionBegin">
      <e-columns>
        <e-column field="OrderID" headerText="Order ID" width="120" textAlign="Right" isPrimaryKey="true" :validationRules="orderIDRules"></e-column>
        <e-column field='EmployeeID' headerText='Employee Name' width='120' :dataSource='employeeData'
        foreignKeyValue='FirstName' foreignKeyField='EmployeeID' :editTemplate="'editTemplate'">
          <template v-slot:editTemplate>
            <ejs-dropdownlist id="EmployeeID" width="220" :dataSource="employeeData" :value="orderData.EmployeeID" :fields="dropDownFields" 
            :itemTemplate="'iTemplate'">
              <template v-slot:iTemplate="{ data }">
                <div>
                  <img class="empImage" width="50px" :src="'https://ej2.syncfusion.com/demos/src/grid/images/' + data.EmployeeID + '.png'" 
                    alt="employee" />
                  <div class="ename"></div>
                </div>
              </template>
            </ejs-dropdownlist>
          </template>
        </e-column>
        <e-column field="Freight" headerText="Freight" width="120" format="C2" textAlign="Right" editType="numericedit" :validationRules="freightRules"></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="130" editType="datepickeredit" 
        format="yMd" textAlign="Right" :validationRules="orderDateRules"></e-column>
        <e-column field="ShipCountry" headerText="Ship Country" width="150" :validationRules="shipCountryRules">
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit ,ForeignKey } from "@syncfusion/ej2-vue-grids";
import { DropDownListComponent as EjsDropdownlist } from "@syncfusion/ej2-vue-dropdowns";
import { data, employeeData } from './datasource.js';

const dataGrid = data;
const editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode: "Normal" };
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules = { required: true, number: true };
const freightRules = { required: true, min: 1, max: 1000 };
const shipCountryRules = { required: true };
const orderDateRules = { required: true };
const dropDownFields= { text: 'FirstName', value: 'EmployeeID' };

let orderData = ref({});
const actionBegin = (args) => {
  if (args.requestType === "beginEdit" || args.requestType === "add") {
    orderData.value = { ...args.rowData };
  }
  if (args.requestType === "save") {
    orderData.value["EmployeeID"]=args.data["EmployeeID"] ;
  }
};

provide("grid", [Edit, Toolbar,ForeignKey ]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource="dataGrid" :editSettings="editSettings" :toolbar="toolbar" height="273px" :actionBegin="actionBegin">
      <e-columns>
        <e-column field="OrderID" headerText="Order ID" width="120" textAlign="Right" isPrimaryKey="true" :validationRules="orderIDRules"></e-column>
        <e-column field='EmployeeID' headerText='Employee Name' width='120' :dataSource='employeeData' 
        foreignKeyValue='FirstName' foreignKeyField='EmployeeID' :editTemplate="'editTemplate'">
          <template v-slot:editTemplate>
            <ejs-dropdownlist id="EmployeeID" width="220" :dataSource="employeeData" :value="orderData.EmployeeID" :fields="dropDownFields" 
            :itemTemplate="'iTemplate'">
              <template v-slot:iTemplate="{ data }">
                <div>
                  <img class="empImage" width="50px" :src="'https://ej2.syncfusion.com/demos/src/grid/images/' + data.EmployeeID + '.png'" 
                    alt="employee" />
                  <div class="ename"></div>
                </div>
              </template>
            </ejs-dropdownlist>
          </template>
        </e-column>

        <e-column field="Freight" headerText="Freight" width="120" format="C2" textAlign="Right" editType="numericedit" :validationRules="freightRules"></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="130" editType="datepickeredit" 
        format="yMd" textAlign="Right" :validationRules="orderDateRules"></e-column>
        <e-column field="ShipCountry" headerText="Ship Country" width="150" :validationRules="shipCountryRules">
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit, ForeignKey } from "@syncfusion/ej2-vue-grids";
import { DropDownListComponent } from "@syncfusion/ej2-vue-dropdowns";
import { data, employeeData } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    "ejs-dropdownlist": DropDownListComponent,
  },
  data() {
    return {
      dataGrid: data,
      employeeData: employeeData,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      shipCountryRules: { required: true },
      orderDateRules: { required: true },
      dropDownFields: { text: 'FirstName', value: 'EmployeeID' },
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['EmployeeID']=args.data['EmployeeID'] ;
      }
    }
  },
  provide() {
    return {
      grid: [Edit, Toolbar, ForeignKey],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Render Multiple columns in DropDownList component

The Syncfusion Grid allows you to render a DropDownList component within the Grid’s edit form for a specific column. This feature is particularly useful when you want to display more detailed information for each item in the dropdown list during editing a specific column.

To render a DropDownList in the edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

The DropDownList has been provided with several options to customize each list item, group title, selected value, header, and footer element. By default, list items can be rendered as a single column in the DropDownList component. Instead of this, multiple columns can be rendered. This can be achieved by using the headerTemplate and itemTemplate properties of the DropDownList component.

The following example demonstrates how to render a DropDownList component with multiple columns within in the ShipCountry column. The actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid :dataSource="data" :editSettings="editSettings" :toolbar="toolbar" height="273px" :actionBegin="actionBegin">
      <e-columns>
        <e-column field="OrderID" headerText="Order ID" width="120" textAlign="Right" isPrimaryKey="true" :validationRules="orderIDRules"></e-column>
        <e-column field="CustomerID" headerText="Customer ID" width="150" :validationRules="shipCountryRules"></e-column>
        <e-column field="Freight" headerText="Freight" width="120" format="C2" textAlign="Right" editType="numericedit" :validationRules="freightRules"></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="130" editType="datepickeredit" format="yMd" textAlign="Right" :validationRules="orderDateRules"></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='120' :editTemplate="'editTemplate'">
          <template v-slot:editTemplate>
            <ejs-dropdownlist id="ShipCountry"  :dataSource="data" width="300" :fields="dropDownFields" :query='query' :value="orderData.ShipCountry" 
              :itemTemplate="'itemTemplate'" :headerTemplate="'headerTemplate'">
              <template v-slot:headerTemplate>
                <table>
                  <tr>
                    <th>EmployeeID</th>
                    <th>ShipCountry</th>
                  </tr>
                </table>
              </template>
              <template v-slot:itemTemplate="{ data }">
                <div class="e-grid">
                  <table class="e-table">
                    <tbody>
                      <tr>
                        <td class="e-rowcell"></td>
                        <td class="e-rowcell"></td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </template>
            </ejs-dropdownlist>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { DropDownListComponent } from "@syncfusion/ej2-vue-dropdowns";
import { data} from './datasource.js';
import { Query } from '@syncfusion/ej2-data';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    "ejs-dropdownlist": DropDownListComponent,
  },
  data() {
    return {
      data: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      shipCountryRules: { required: true },
      orderDateRules: { required: true },
      dropDownFields: { text: 'ShipCountry', value: 'ShipCountry' },
      query : new Query()
        .from('data')
        .select(['EmployeeID', 'ShipCountry'])
        .take(6),
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['ShipCountry']=args.data['ShipCountry'] ;
      }
    }
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";


.content {
            margin: 0 auto;
            width: 550px;
        }

        table {
            width: 100%;
            border-collapse: separate;
            table-layout: fixed;
        }

        th,
        td {
            border-width: 1px 0 0 1px;
            border-color: #e0e0e0;
            text-align: left;
            border-style: solid;
            display: table-cell;
        }

        th {
            line-height: 36px;
            text-indent: 16px;
        }

        .e-ddl-header {
            padding-right: 17px;
            border-width: 1px 0px 1px 0px;
            border-color: #e0e0e0;
            border-style: solid;
        }

        .e-dropdownbase .e-list-item {
            padding-right: 0px;
        }
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource="data" :editSettings="editSettings" :toolbar="toolbar" height="273px" :actionBegin="actionBegin">
      <e-columns>
        <e-column field="OrderID" headerText="Order ID" width="120" textAlign="Right" isPrimaryKey="true" :validationRules="orderIDRules"></e-column>
        <e-column field="CustomerID" headerText="Customer ID" width="150" :validationRules="shipCountryRules"></e-column>
        <e-column field="Freight" headerText="Freight" width="120" format="C2" textAlign="Right" editType="numericedit" :validationRules="freightRules"></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="130" editType="datepickeredit" format="yMd" textAlign="Right" :validationRules="orderDateRules"></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='120' :editTemplate="'editTemplate'">
          <template v-slot:editTemplate>
            <ejs-dropdownlist id="ShipCountry"  :dataSource="data" width="300" :fields="dropDownFields" :query='query' :value="orderData.ShipCountry" 
              :itemTemplate="'itemTemplate'" :headerTemplate="'headerTemplate'">
              <template v-slot:headerTemplate>
                <table>
                  <tr>
                    <th>EmployeeID</th>
                    <th>ShipCountry</th>
                  </tr>
                </table>
              </template>
              <template v-slot:itemTemplate="{ data }">
                <div class="e-grid">
                  <table class="e-table">
                    <tbody>
                      <tr>
                        <td class="e-rowcell"></td>
                        <td class="e-rowcell"></td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </template>
            </ejs-dropdownlist>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { DropDownListComponent } from "@syncfusion/ej2-vue-dropdowns";
import { data } from './datasource.js';
import { Query } from '@syncfusion/ej2-data';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    "ejs-dropdownlist": DropDownListComponent,
  },
  data() {
    return {
      data: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      shipCountryRules: { required: true },
      orderDateRules: { required: true },
      dropDownFields: { text: 'ShipCountry', value:'ShipCountry' },
      query: new Query().from('data').select(['EmployeeID', 'ShipCountry']).take(6),
      orderData: { } 

    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['ShipCountry'] = args.data['ShipCountry'];
      }
    }
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";

.content {
    margin: 0 auto;
    width: 550px;
}

table {
    width: 100%;
    border-collapse: separate;
    table-layout: fixed;
}

th,
td {
    border-width: 1px 0 0 1px;
    border-color: #e0e0e0;
    text-align: left;
    border-style: solid;
    display: table-cell;
}

th {
    line-height: 36px;
    text-indent: 16px;
}

.e-ddl-header {
    padding-right: 17px;
    border-width: 1px 0px 1px 0px;
    border-color: #e0e0e0;
    border-style: solid;
}

.e-dropdownbase .e-list-item {
    padding-right: 0px;
}
</style>

Render ComboBox component in edit form

The Syncfusion Grid allows you to render a ComboBox component within the Grid’s edit form for a specific column. This feature is especially valuable when you need to provide a drop-down selection with auto-suggestions for data entry.

To render a ComboBox component in the edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

The following example demonstrates how to render a ComboBox component in the ShipCountry column of the Syncfusion Grid. The actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='150' :editTemplate="'editTemplate'" :validationRules='shipCountryRules'>
          <template v-slot:editTemplate>
              <ejs-combobox id="ShipCountry"  :value='orderData.ShipCountry' :dataSource='selectDatasource'></ejs-combobox>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { ComboBoxComponent as EjsCombobox } from "@syncfusion/ej2-vue-dropdowns";
import { data } from "./datasource.js";

const dataGrid = data;
const editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode: "Normal" };
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules = { required: true, number: true };
const freightRules = { required: true, min: 1, max: 1000 };
const customerIDRules = { required: true };
const shipCountryRules = { required: true };
const orderDateRules = { required: true };
const selectDatasource =[
        { text: 'Germany', value: 'Germany' },
        { text: 'Brazil', value: 'Brazil' },
        { text: 'Belgium', value: 'Belgium' },
        { text: 'Switzerland', value: 'Switzerland' },
        { text: 'Venezuela', value: 'Venezuela' },
        { text: 'Austria', value: 'Austria' },
        { text: 'Mexico', value: 'Mexico' },
      ];
let orderData = ref({});
const actionBegin = (args) => {
  if (args.requestType === "beginEdit" || args.requestType === "add") {
    orderData.value = { ...args.rowData };
  }
  if (args.requestType === "save") {
    orderData.value["ShipCountry"]= args.data["ShipCountry"];
  }
};

provide("grid", [Edit, Toolbar]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'></e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='150' :editTemplate="'editTemplate'" :validationRules='shipCountryRules'>
          <template v-slot:editTemplate>
              <ejs-combobox id="ShipCountry"  :value='orderData.ShipCountry' :dataSource='selectDatasource'></ejs-combobox>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { ComboBoxComponent } from "@syncfusion/ej2-vue-dropdowns";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    'ejs-combobox' : ComboBoxComponent,
  },
  data() {
    return {
      dataGrid: data,
      selectDatasource :[
        { text: 'Germany', value: 'Germany' },
        { text: 'Brazil', value: 'Brazil' },
        { text: 'Belgium', value: 'Belgium' },
        { text: 'Switzerland', value: 'Switzerland' },
        { text: 'Venezuela', value: 'Venezuela' },
        { text: 'Austria', value: 'Austria' },
        { text: 'Mexico', value: 'Mexico' },
      ],
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCountryRules: { required: true },
      orderDateRules: { required: true },
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['ShipCountry']=args.data['ShipCountry'] ;
      }

    }
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Render TimePicker component in edit form

The Syncfusion Grid allows you to render a TimePicker component within the Grid’s edit form for a specific column. This feature is especially valuable when you need to provide a time input, such as appointment times, event schedules, or any other time-related data for editing in the Grid.

To render a TimePicker component in the edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

The following example demonstrates how to render a TimePicker component in the Order Time column of the Syncfusion Grid. The actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Time' type="date" width='130' :editTemplate="'editTemplate'" editType='datepickeredit' format='hh :mm a ' textAlign='Right' :validationRules='orderDateRules'>
          <template v-slot:editTemplate>
            <ejs-timepicker id="OrderDate" :value='orderData.OrderDate'></ejs-timepicker >
          </template>
        </e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='150'   :validationRules='shipCountryRules'>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref} from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
  import { TimePickerComponent as EjsTimepicker } from "@syncfusion/ej2-vue-calendars";
import { data } from './datasource.js';
const dataGrid= data;
const editSettings= { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' };
const toolbar= ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules= { required: true, number: true };
const freightRules= { required: true, min: 1, max: 1000 };
const customerIDRules={ required: true };
const orderDateRules= { required: true };
const shipCountryRules= { required: true };

let orderData=ref(null);

const actionBegin=function(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
          orderData.value = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        orderData.value['OrderDate']=args.data['OrderDate'] ;
      }

};
  provide('grid',  [Page, Edit, Toolbar]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Time' type="date" width='130' :editTemplate="'editTemplate'" editType='datepickeredit' format='hh :mm a ' textAlign='Right' :validationRules='orderDateRules'>
          <template v-slot:editTemplate>
            <ejs-timepicker id="OrderDate" :value='orderData.OrderDate'></ejs-timepicker >
          </template>
        </e-column>
        <e-column field='ShipCountry' headerText='Ship Country' width='150'   :validationRules='shipCountryRules'>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { TimePickerComponent } from "@syncfusion/ej2-vue-calendars";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    "ejs-timepicker": TimePickerComponent
  },
  data() {
    return {
      dataGrid: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCountryRules: { required: true },
      orderDateRules: { required: true },
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['OrderDate']=args.data['OrderDate'] ;
      }

    }
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/tailwind.css";

</style>

Render MultiSelect component in edit form

The Syncfusion Grid allows you to render a MultiSelect component within the Grid’s edit form, enabling you to select multiple values from a dropdown list when editing a specific column. This feature is particularly useful when you need to handle situations where multiple selections are required for a column.

To render a MultiSelect component in the edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

The following example demonstrates how to render a MultiSelect component in the ShipCity column of the Syncfusion Grid. The actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'>
        </e-column>
        <e-column field='ShipCity' headerText='Ship City' width='150' :editTemplate="'editTemplate'" :validationRules='shipCityRules'>
          <template  v-slot:editTemplate>
            <ejs-multiselect id='ShipCity' :dataSource='multiSelectDatasource' v-model="orderData.ShipCity"  :fields='fields'></ejs-multiselect>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { MultiSelectComponent as EjsMultiselect } from "@syncfusion/ej2-vue-dropdowns";
import { data } from './datasource.js';

const dataGrid = data;
const editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' };
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules = { required: true, number: true };
const freightRules = { required: true, min: 1, max: 1000 };
const customerIDRules = { required: true };
const shipCityRules = { required: true };
const orderDateRules = { required: true };
const multiSelectDatasource = [
  { value: 'Reims', text: 'Reims' },
  { value: 'Münster', text: 'Münster' },
  { value: 'Rio de Janeiro', text: 'Rio de Janeiro' },
  { value: 'Lyon', text: 'Lyon' },
  { value: 'Charleroi', text: 'Charleroi' }
];
const fields = { value: 'value', text: 'text' };
let orderData = ref({});

const actionBegin = function(args) {
  if (args.requestType === 'beginEdit' || args.requestType === 'add') {
    orderData.value = Object.assign({}, args.rowData);
    orderData.value['ShipCity'] = orderData.value['ShipCity'] ? orderData.value['ShipCity'].split(',') : [];
  }
  if (args.requestType === 'save') {
    args.data['ShipCity'] = orderData.value['ShipCity'].join(',');
  }
};

provide('grid', [Page, Edit, Toolbar]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px' :actionBegin='actionBegin'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' :validationRules='orderIDRules'></e-column>
        <e-column field='CustomerID' headerText='Customer Name' width='120' :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type="date" width='130' editType='datepickeredit' format='yMd' textAlign='Right' :validationRules='orderDateRules'>
        </e-column>
        <e-column field='ShipCity' headerText='Ship City' width='150' :editTemplate="'editTemplate'" :validationRules='shipCityRules'>
          <template  v-slot:editTemplate>
            <ejs-multiselect id='ShipCity' :dataSource='multiSelectDatasource' v-model="orderData.ShipCity"  :fields='fields'></ejs-multiselect>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { MultiSelectComponent } from "@syncfusion/ej2-vue-dropdowns";
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    'ejs-multiselect' : MultiSelectComponent,
  },
  data() {
    return {
      dataGrid: data,
      multiSelectDatasource : [
        { value: 'Reims', text: 'Reims' },
        { value: 'Münster', text: 'Münster' },
        { value: 'Rio de Janeiro', text: 'Rio de Janeiro' },
        { value: 'Lyon', text: 'Lyon' },
        { value: 'Charleroi', text: 'Charleroi' }
      ],
      fields : { value: 'value', text: 'text' },
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      orderDateRules: { required: true },
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
        this.orderData['ShipCity'] = this.orderData['ShipCity'] ? this.orderData['ShipCity'].split(',') : [];
      }
      if (args.requestType === 'save') {
        args.data['ShipCity'] = this.orderData['ShipCity'].join(',');
      }

    }
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Render RichTextEditor component in edit form

The Syncfusion Grid allows you to render the RichTextEditor component within the edit form. This feature is valuable when you need to format and style text content using various formatting options such as bold, italic, underline, bullet lists, numbered lists, and more during editing a specific column.

To render RichTextEditor component in edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

Additionally, you need set the allowTextWrap property of the corresponding grid column to true. By enabling this property, the rich text editor component will automatically adjust its width and wrap the text content to fit within the boundaries of the column.

The following example demonstrates how to render a RichTextEditor component in the ShipAddress column of the Syncfusion Grid. The actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid :dataSource="data" :editSettings="editSettings" :toolbar="toolbar" height="273px" :actionBegin="actionBegin">
      <e-columns>
        <e-column field="OrderID" headerText="Order ID" width="120" textAlign="Right" isPrimaryKey="true" :validationRules="orderIDRules"></e-column>
        <e-column field="CustomerID" headerText="Customer ID" width="150" :validationRules="customerIDRules"></e-column>
        <e-column field="Freight" headerText="Freight" width="120" format="C2" textAlign="Right" editType="numericedit" :validationRules="freightRules"></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="130" editType="datepickeredit" 
        format="yMd" textAlign="Right" :validationRules="orderDateRules"></e-column>
        <e-column field='ShipAddress' headerText='Ship Address' width='120' :editTemplate="'editTemplate'" :disableHtmlEncode="false">
          <template v-slot:editTemplate="{data }">
            <div v-if="data && data.ShipAddress !== undefined">
              <ejs-richtexteditor id="ShipAddress" :value="orderData.ShipAddress" :focus="onFocus"></ejs-richtexteditor>
            </div>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { RichTextEditorComponent as EjsRichtexteditor, HtmlEditor, Toolbar as RichTextEditorToolbar, QuickToolbar} from '@syncfusion/ej2-vue-richtexteditor'; // Renamed Toolbar
import { data } from "./datasource.js";


const editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode: "Normal" };
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules = { required: true, number: true };
const freightRules = { required: true, min: 1, max: 1000 };
const customerIDRules = { required: true };
const orderDateRules = { required: true };
let orderData = ref({});

const actionBegin=(args)=> {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        orderData.value = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        orderData.value['ShipAddress']=args.data['ShipAddress'] ;
      }
    };
const onFocus=(args)=> {
      args.event.target.addEventListener('keydown', (e) => {
        if (e.key === 'Enter') {
          e.stopPropagation();
        }
      });
    
    };

provide("grid", [Edit, Toolbar]);
provide("richtexteditor", [HtmlEditor, RichTextEditorToolbar, QuickToolbar]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-filemanager/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-richtexteditor/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource="data" :editSettings="editSettings" :toolbar="toolbar" height="273px" :actionBegin="actionBegin">
      <e-columns>
        <e-column field="OrderID" headerText="Order ID" width="120" textAlign="Right" isPrimaryKey="true" :validationRules="orderIDRules"></e-column>
        <e-column field="CustomerID" headerText="Customer ID" width="150" :validationRules="shipCountryRules"></e-column>
        <e-column field="Freight" headerText="Freight" width="120" format="C2" textAlign="Right" editType="numericedit" :validationRules="freightRules"></e-column>
        <e-column field="OrderDate" headerText="Order Date" type="date" width="130" editType="datepickeredit" 
        format="yMd" textAlign="Right" :validationRules="orderDateRules"></e-column>
        <e-column field='ShipAddress' headerText='Ship Address' width='120' :editTemplate="'editTemplate'" :disableHtmlEncode="false">
          <template v-slot:editTemplate="{data }">
            <div v-if="data && data.ShipAddress !== undefined">
              <ejs-richtexteditor id="ShipAddress" :value="orderData.ShipAddress" :focus="onFocus"></ejs-richtexteditor>
            </div>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { RichTextEditorComponent, HtmlEditor, Inject as RichTextEditorInject, Toolbar as RichTextEditorToolbar, QuickToolbar} from '@syncfusion/ej2-vue-richtexteditor'; // Renamed Toolbar
import { data } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    "ejs-richtexteditor": RichTextEditorComponent
  },
  data() {
    return {
      data: data,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      shipCountryRules: { required: true },
      orderDateRules: { required: true },
      orderData: {}
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'beginEdit' || args.requestType === 'add') {
        this.orderData = Object.assign({}, args.rowData);
      }
      if (args.requestType === 'save') {
        this.orderData['ShipAddress']=args.data['ShipAddress'] ;
      }
    },
    onFocus(args) {
      args.event.target.addEventListener('keydown', (e) => {
        if (e.key === 'Enter') {
          e.stopPropagation();
        }
      });
    
    },
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
      richtexteditor: [ HtmlEditor, RichTextEditorToolbar, QuickToolbar]
    };
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-filemanager/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-richtexteditor/styles/tailwind.css";
</style>

Render Upload component in edit form

The Syncfusion Grid allows you to render an Upload component within the Grid’s edit form. This feature is especially valuable when you need to upload and manage files or images in a specific column during data editing.

To render Upload component in edit form, you need to define an editTemplate for the column using template. The editTemplate property specifies the cell edit template that used as an editor for a particular column. It can accept either a template string or an HTML element ID.

The following example demonstrates how to render a Upload component in the Employee Image column of the Syncfusion Grid. The actionBegin event is handled to update the edited value in the grid when the save button is clicked:

<template>
  <div id="app">
    <ejs-grid :dataSource="data" :editSettings="editSettings" :toolbar="toolbar" @actionBegin="actionBegin">
      <e-columns>
        <e-column field="EmployeeID" headerText="Employee ID" textAlign="Right" isPrimaryKey="true" :validationRules="employeeIRules" width="100"></e-column>
        <e-column field="FirstName" headerText="First Name" textAlign="Left" width="120" :validationRules="firstNameRules"></e-column>
        <e-column field="LastName" headerText="Last Name" textAlign="Left" width="120" :validationRules="lastNameRules"></e-column>
        <e-column field="Title" headerText="Title" textAlign="Left" width="120" :validationRules="titleRules"></e-column>
        <e-column headerText="Employee Image" width="150" template="template" :editTemplate="'editTemplate'" textAlign="Center">
          <template v-slot:template="{ data }">
            <div class="image">
              <img :src="data.Image ? data.Image : 'https://ej2.syncfusion.com/angular/demos/assets/grid/images/' + data.EmployeeID + '.png'" alt="Employee Image" />
            </div>
          </template>
          <template v-slot:editTemplate>
            <ejs-uploader ref="uploader" :asyncSettings="path" :multiple="false" :success="onUploadSuccess"></ejs-uploader>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script setup>
import { provide, ref } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { UploaderComponent as EjsUploader } from '@syncfusion/ej2-vue-inputs';
import { employeeData } from './datasource.js';

const data = employeeData;
const editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode: "Normal" };
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const strm = ref("");
const employeeIRules = { required: true };
const firstNameRules = { required: true };
const lastNameRules ={ required: true};
const titleRules = { required: true};

const path = {
  saveUrl: 'https://services.syncfusion.com/react/production/api/FileUploader/Save',
  removeUrl: 'https://services.syncfusion.com/react/production/api/FileUploader/Remove',
};

const actionBegin = (args) => {
  if (args.requestType === 'save') {
    if (strm.value) { 
      args.data['Image'] = strm.value; 
      strm.value = ""; 
    }
  }
};

const onUploadSuccess = (args) => {
  if (args.operation === 'upload') {
    const fileBlob = args.file.rawFile;
    const file = new File([fileBlob], args.file.name);
    getBase64(file);
  }
};

const getBase64 = (file) => {
  const reader = new FileReader();
  reader.readAsDataURL(file);
  reader.onload = () => {
    strm.value = reader.result; 
  };
};

provide("grid", [Edit, Toolbar]);
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";

.image img {
  height: 55px;
  width: 55px;
  border-radius: 50px;
  box-shadow: inset 0 0 1px #e0e0e0, inset 0 0 14px rgba(0, 0, 0, 0.2);
}
</style>
<template>
  <div id="app">
    <ejs-grid :dataSource="data" :editSettings="editSettings" :toolbar="toolbar" @actionBegin="actionBegin">
      <e-columns>
        <e-column field="EmployeeID" headerText="Employee ID" textAlign="Right" isPrimaryKey="true" :validationRules='employeeIRules'  width="100"></e-column>
        <e-column field="FirstName" headerText="First Name" textAlign="Left" width="120" :validationRules='firstNameRules'></e-column>
        <e-column field="LastName" headerText="Last Name" textAlign="Left" width="120"  :validationRules='lastNameRules'></e-column>
        <e-column field="Title" headerText="Title" textAlign="Left" width="120" :validationRules='titleRules'></e-column>
        <e-column headerText="Employee Image" width="150" template="template" :editTemplate="'editTemplate'" textAlign="Center">
          <template v-slot:template="{ data }">
            <div class="image">
              <img :src="data.Image ? data.Image : 'https://ej2.syncfusion.com/angular/demos/assets/grid/images/' + data.EmployeeID + '.png'" alt="Employee Image" />
            </div>
          </template>
          <template v-slot:editTemplate>
            <ejs-uploader ref="uploader" :asyncSettings="path" :multiple="false" :success="onUploadSuccess"></ejs-uploader>
          </template>
        </e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>

<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Edit, Toolbar } from "@syncfusion/ej2-vue-grids";
import { UploaderComponent } from "@syncfusion/ej2-vue-inputs";
import {  employeeData } from './datasource.js';

export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
    "ejs-uploader": UploaderComponent,
  },
  data() {
    return {
      data: employeeData,
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
      employeeIRules : { required: true },
      firstNameRules : { required: true },
      lastNameRules : { required: true},
      titleRules : { required: true},

      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      path: {
        saveUrl: 'https://services.syncfusion.com/react/production/api/FileUploader/Save',
        removeUrl: 'https://services.syncfusion.com/react/production/api/FileUploader/Remove',
      },
      strm: ''
    };
  },
  methods: {
    actionBegin(args) {
      if (args.requestType === 'save') {
        if(this.strm){
          args.data['Image'] = this.strm;
          this.strm="";
        }
      }
    },
    onUploadSuccess(args) {
      if (args.operation === 'upload') {
        const fileBlob = args.file.rawFile;
        const file = new File([fileBlob], args.file.name);
        this.getBase64(file);
      }
    },
    getBase64(file) {
      const reader = new FileReader();
      reader.readAsDataURL(file);
      reader.onload = () => {
        this.strm = reader.result;
      };
    },
  },
  provide() {
    return {
      grid: [Edit, Toolbar],
    };
  },
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";

.image img {
        height: 55px;
        width: 55px;
        border-radius: 50px;
        box-shadow: inset 0 0 1px #e0e0e0, inset 0 0 14px rgba(0,0,0,0.2);
    }
</style>

By default, the grid saves the cell when clicking outside the editor component. If your components, like multiple popups, are dynamically rendered, the grid may not recognize them, causing the editor to close when the popup is clicked. To prevent this, apply the edit-custom-template class to both your main component and sub-components. If you are using Syncfusion components, set their cssClass property to include the edit-custom-template class.

Render custom cell editors using external function

The Syncfusion Grid provides the ability to render custom cell editors, allowing you to add custom components to specific columns in your grid using the cell edit template feature. This feature is useful when you need to edit cell values using custom input elements or controls.

To utilize the custom cell editor template feature, you need to implement the following functions:

  • create - It is used to create the element at the time of initialization.

  • write - It is used to create custom component or assign default value at the time of editing.

  • read - It is used to read the value from the component at the time of save.

  • destroy - It is used to destroy the component.

Render AutoComplete component in edit form

The Syncfusion Grid allows you to render the AutoComplete component within the edit form by using the cell edit template feature.This feature enables you to select values from a predefined list during the editing of a specific column. It is especially valuable when you need to provide a dropdown-like auto-suggestion and input assistance for data entry in the Grid’s columns.

To achieve this, you need to utilize the columns->edit->params property along with a defined object that specifies the necessary functions for creating, reading, and writing the auto complete component.

The following example demonstrates how to render a Autocomplete component in the CustomerID column:

<template>
  <div id="app">
    <ejs-grid ref='grid' :dataSource='dataGrid' :allowPaging='true' :editSettings='editSettings' :pageSettings='pageSettings' :toolbar='toolbar' height='175px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' type='number' textAlign='Right' :isPrimaryKey='true' :validationRules='orderIDRules' width=100></e-column>
        <e-column field='CustomerID' headerText='Customer ID' type='string' :edit='daParams' width=140 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' type='number' textAlign='Right' editType='numericedit' format='C2' width=120 :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type='date' editType='datepickeredit' textAlign='Right' format='yMd' width=150  :validationRules='orderDateRules'></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script setup>
import { provide } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page,
  Toolbar,Edit } from "@syncfusion/ej2-vue-grids";
import { AutoComplete } from "@syncfusion/ej2-dropdowns";
import { data } from "./datasource.js";
let inpuElement;
let autoCompleteInstance;
let autoCompleteData = [
  { CustomerID: "VINET", Id: "1" },
  { CustomerID: "TOMSP", Id: "2" },
  { CustomerID: "HANAR", Id: "3" },
  { CustomerID: "VICTE", Id: "4" },
  { CustomerID: "SUPRD", Id: "5" },
];
function createCustomerIDFunction() {
  inpuElement = document.createElement("input");
  return inpuElement;
}
function destroyCustomerIDFunction() {
  autoCompleteInstance.destroy();
}
function readCustomerIDFunction() {
  return autoCompleteInstance.value;
}
function writeCustomerIDFunction(args) {
  autoCompleteInstance = new AutoComplete({
    allowCustom: true,
    value: args.rowData[args.column.field],
    dataSource: autoCompleteData,
    fields: { value: "CustomerID", text: "CustomerID" },
  });
  autoCompleteInstance.appendTo(inpuElement);
}
const dataGrid = data;
const pageSettings = { pageSizes: true, pageSize: 5 };
const editSettings = {
  allowEditing: true,
  allowAdding: true,
  allowDeleting: true,
};
const daParams = {
  create: createCustomerIDFunction,
  destroy: destroyCustomerIDFunction,
  read: readCustomerIDFunction,
  write: writeCustomerIDFunction,
};
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules = { required: true, number: true };
const freightRules = { required: true, min: 1, max: 1000 };
const customerIDRules = { required: true };
const orderDateRules = { required: true };
provide("grid", [Page, Edit, Toolbar]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
    <ejs-grid ref='grid' :dataSource='dataGrid' :allowPaging='true' :editSettings='editSettings' :pageSettings='pageSettings' :toolbar='toolbar' height='175px'>
      <e-columns>
        <e-column field='OrderID' headerText='Order ID' type='number' textAlign='Right' :isPrimaryKey='true' :validationRules='orderIDRules' width=100></e-column>
        <e-column field='CustomerID' headerText='Customer ID' type='string' :edit='daParams' width=140 :validationRules='customerIDRules'></e-column>
        <e-column field='Freight' headerText='Freight' type='number' textAlign='Right' editType='numericedit' format='C2' width=120 :validationRules='freightRules'></e-column>
        <e-column field='OrderDate' headerText='Order Date' type='date' editType='datepickeredit' textAlign='Right' format='yMd' width=150  :validationRules='orderDateRules'></e-column>
      </e-columns>
    </ejs-grid>
  </div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { AutoComplete } from "@syncfusion/ej2-dropdowns";
import { data } from './datasource.js';
let inpuElement;
let autoCompleteInstance;
let autoCompleteData = [
  { CustomerID: "VINET", Id: "1" },
  { CustomerID: "TOMSP", Id: "2" },
  { CustomerID: "HANAR", Id: "3" },
  { CustomerID: "VICTE", Id: "4" },
  { CustomerID: "SUPRD", Id: "5" },
];
function createCustomerIDFunction() {
  inpuElement = document.createElement("input");
  return inpuElement;
}
function destroyCustomerIDFunction() {
  autoCompleteInstance.destroy();
}
function readCustomerIDFunction() {
  return autoCompleteInstance.value;
}
function writeCustomerIDFunction(args) {
  autoCompleteInstance = new AutoComplete({
    allowCustom: true,
    value: args.rowData[args.column.field],
    dataSource: autoCompleteData,
    fields: { value: "CustomerID", text: "CustomerID" },
  });
  autoCompleteInstance.appendTo(inpuElement);
}
export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data() {
    return {
      dataGrid: data,
      pageSettings: { pageSizes: true, pageSize: 5 },
      editSettings: {
        allowEditing: true,
        allowAdding: true,
        allowDeleting: true,
      },
      daParams: {
        create: createCustomerIDFunction,
        destroy: destroyCustomerIDFunction,
        read: readCustomerIDFunction,
        write: writeCustomerIDFunction,
      },
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      orderIDRules: { required: true, number: true },
      freightRules: { required: true, min: 1, max: 1000 },
      customerIDRules: { required: true },
      shipAddressRules: { required: true },
      orderDateRules: { required: true },
    };
  },

  provide: {
    grid: [Page, Edit, Toolbar],
  },
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>

Render cascading DropDownList component in edit form

The Syncfusion Grid allows you to render the cascading DropDownList within the edit form by using the cell edit template feature.This feature is especially useful when you need to establish a hierarchy of options, such as choosing a country and then selecting a state based on the chosen country.

To achieve this, you need to utilize the columns->edit->params property along with a defined object that specifies the necessary functions for creating, reading, and writing the auto complete component.

In the below demo, cascading DropDownList rendered for ShipCountry and ShipState column.

<template>
  <div id="app">
      <ejs-grid ref='grid' :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px'>
          <e-columns>
              <e-column field='OrderID' headerText='Order ID' :isPrimaryKey='true' textAlign='Right' width=100 :validationRules='orderIDRules'></e-column>
              <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
              <e-column field='ShipCountry' headerText='ShipCountry' editType='dropdownedit' :edit='countryParams' width=150 :validationRules='shipCountryRules'></e-column>
             <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :edit='stateParams' width=150 :validationRules='shipCityRules'></e-column>
          </e-columns>
      </ejs-grid>
  </div>
</template>
<script setup>
import { provide} from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns,Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
import { DropDownList } from "@syncfusion/ej2-dropdowns";
import { Query } from '@syncfusion/ej2-data';

const dataGrid = data;
let country = [
  { countryName: "United States", countryId: "1" },
  { countryName: "Australia", countryId: "2" },
];
let state = [
  { stateName: "New York", countryId: "1", stateId: "101" },
  { stateName: "Virginia ", countryId: "1", stateId: "102" },
  { stateName: "Washington", countryId: "1", stateId: "103" },
  { stateName: "Queensland", countryId: "2", stateId: "104" },
  { stateName: "Tasmania ", countryId: "2", stateId: "105" },
  { stateName: "Victoria", countryId: "2", stateId: "106" },
];
let countryElement, stateElement, countryObject, stateObject;

const editSettings = {
  allowEditing: true,
  allowAdding: true,
  allowDeleting: true,
  mode: "Normal",
};
const toolbar = ["Add", "Edit", "Delete", "Update", "Cancel"];
const orderIDRules = { required: true, number: true };
const customerIDRules = { required: true };
const shipCountryRules = { required: true };
const shipCityRules = { required: true };

const countryParams = {
  create: () => {
    countryElement = document.createElement("input");
    return countryElement;
  },
  read: () => {
    return countryObject.text;
  },
  destroy: () => {
    countryObject.destroy();
  },
  write: () => {
    countryObject = new DropDownList({
      dataSource: country,
      fields: { value: "countryId", text: "countryName" },
      change: () => {
        stateObject.enabled = true;
        let tempQuery = new Query().where(
          "countryId",
          "equal",
          countryObject.value
        );
        stateObject.query = tempQuery;
        stateObject.text = null;
        stateObject.dataBind();
      },
      placeholder: "Select a country",
      floatLabelType: "Never",
    });
    countryObject.appendTo(countryElement);
  },
};
const stateParams = {
  create: () => {
    stateElement = document.createElement("input");
    return stateElement;
  },
  read: () => {
    return stateObject.text;
  },
  destroy: () => {
    stateObject.destroy();
  },
  write: () => {
    stateObject = new DropDownList({
      dataSource: state,
      fields: { value: "stateId", text: "stateName" },
      enabled: false,
      placeholder: "Select a state",
      floatLabelType: "Never",
    });
    stateObject.appendTo(stateElement);
  },
};

provide("grid", [Edit, Toolbar]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>
<template>
  <div id="app">
      <ejs-grid ref='grid' :dataSource='dataGrid' :editSettings='editSettings' :toolbar='toolbar' height='273px'>
          <e-columns>
              <e-column field='OrderID' headerText='Order ID' :isPrimaryKey='true' textAlign='Right' width=100 :validationRules='orderIDRules'></e-column>
              <e-column field='CustomerID' headerText='Customer ID' width=120 :validationRules='customerIDRules'></e-column>
              <e-column field='ShipCountry' headerText='ShipCountry' editType='dropdownedit' :edit='countryParams' width=150 :validationRules='shipCountryRules'></e-column>
             <e-column field='ShipCity' headerText='Ship City' editType='dropdownedit' :edit='stateParams' width=150 :validationRules='shipCityRules'></e-column>
          </e-columns>
      </ejs-grid>
  </div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective,Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { DropDownList } from "@syncfusion/ej2-dropdowns";
import { Query } from '@syncfusion/ej2-data';
import { data } from './datasource.js';
let country = [
  { countryName: "United States", countryId: "1" },
  { countryName: "Australia", countryId: "2" },
];
let state = [
  { stateName: "New York", countryId: "1", stateId: "101" },
  { stateName: "Virginia ", countryId: "1", stateId: "102" },
  { stateName: "Washington", countryId: "1", stateId: "103" },
  { stateName: "Queensland", countryId: "2", stateId: "104" },
  { stateName: "Tasmania ", countryId: "2", stateId: "105" },
  { stateName: "Victoria", countryId: "2", stateId: "106" },
];
let countryElement, stateElement, countryObject, stateObject;
export default {
  name: "App",
  components: {
    "ejs-grid": GridComponent,
    "e-columns": ColumnsDirective,
    "e-column": ColumnDirective,
  },
  data: () => {
    return {
      dataGrid: data,
      toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
      editSettings: {
        allowEditing: true,
        allowAdding: true,
        allowDeleting: true,
      },
      orderIDRules: { required: true, number: true },
      customerIDRules: { required: true },
      shipCityRules: { required: true },
      shipCountryRules: { required: true },
      countryParams: {
        create: () => {
          countryElement = document.createElement("input");
          return countryElement;
        },
        read: () => {
          return countryObject.text;
        },
        destroy: () => {
          countryObject.destroy();
        },
        write: () => {
          countryObject = new DropDownList({
            dataSource: country,
            fields: { value: "countryId", text: "countryName" },
            change: () => {
              stateObject.enabled = true;
              let tempQuery = new Query().where(
                "countryId",
                "equal",
                countryObject.value
              );
              stateObject.query = tempQuery;
              stateObject.text = null;
              stateObject.dataBind();
            },
            placeholder: "Select a country",
            floatLabelType: "Never",
          });
          countryObject.appendTo(countryElement);
        },
      },
      stateParams: {
        create: () => {
          stateElement = document.createElement("input");
          return stateElement;
        },
        read: () => {
          return stateObject.text;
        },
        destroy: () => {
          stateObject.destroy();
        },
        write: () => {
          stateObject = new DropDownList({
            dataSource: state,
            fields: { value: "stateId", text: "stateName" },
            enabled: false,
            placeholder: "Select a state",
            floatLabelType: "Never",
          });
          stateObject.appendTo(stateElement);
        },
      },
    };
  },
  provide: {
    grid: [Edit, Toolbar],
  },
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/tailwind.css";
</style>