Hi Team,
I have been working on a requirement, where grid has to load data with limited columns and when user changes it to edit mode, we need to show all required columns in adding new line next to the row. I am adding the screenshots please referInitial state of grid
When user changes to edit mode, need to add new line for the selected row
Regards,
Sandeep G
Hi Rajapandiyan,
Can we achieve the same with inline columns edit.
Hi Vignesh,
We have a requirement where grid should show only limited columns initially, but when user changes grid state to edit mode we are supposed to show all the columns as editable fields with in row by opening accordion.
I have added the gif for reference
we don't require to add additional row. Our use case is to show limited columns in view mode and all columns in edit mode
Initial State
Regards,
Sandeep G
|
[App.vue]
<template>
<div id="app">
<ejs-grid
ref="grid"
:dataSource="data"
:editSettings="editSettings"
:toolbar="toolbar"
:actionBegin="actionBegin"
:actionComplete="actionComplete"
height="273px"
>
<e-columns>
<e-column
field="OrderID"
headerText="Order ID"
textAlign="Right"
:isPrimaryKey="true"
width="100"
></e-column>
---
<e-column
field="ShipCountry"
headerText="Ship Country"
:visible="false" // hide the columns at render
editType="dropdownedit"
width="150"
></e-column>
<e-column
field="ShipCity"
headerText="Ship City"
:visible="false" // hide the columns at render
editType="dropdownedit"
width="150"
></e-column>
<e-column
field="ShipName"
headerText="Ship Name"
:visible="false" // hide the columns at render
editType="dropdownedit"
width="150"
></e-column>
----
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from "./datasource.js";
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
editSettings: {
allowEditing: true,
allowAdding: true,
allowDeleting: true,
mode: "Dialog",
},
toolbar: ["Add", "Edit", "Delete", "Update", "Cancel"],
};
},
methods: {
actionBegin: function (args) {
if (args.requestType === "beginEdit" || args.requestType === "add") {
// show the particular columns while editing
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipCountry").visible = true;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipCity").visible = true;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipName").visible = true;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipRegion").visible = true;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipPostalCode").visible = true;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipAddress").visible = true;
}
},
actionComplete: function (args) {
if (args.requestType === "beginEdit" || args.requestType === "add") {
// hide the columns after the edit action
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipCountry").visible = false;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipCity").visible = false;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipName").visible = false;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipRegion").visible = false;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipPostalCode").visible = false;
this.$refs.grid.$el.ej2_instances[0].getColumnByField("ShipAddress").visible = false;
}
},
},
provide: {
grid: [Page, Edit, Toolbar],
},
};
</script>
<style>
</style>
|
Hi
Rajapandiyan,
Thanks for your prompt reply.
Regards,
Sandeep G