We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Not working drag and drop by group on the Grid

Drag and Drop function doesn't work on the DataGrid that made by Group.
It works in a regular Grid well, but if I group the grid, it doesn't work.
Help me..

Attachment: fwatdi.run_ce593109.zip

10 Replies

PS Pavithra Subramaniyam Syncfusion Team February 21, 2019 03:30 AM UTC

Hi Michal, 
Greetings from Syncfusion, 
We have validated your query and the support for row drag and drop with Grouping is not feasible in the Essential JavaScript 2 Grid. So We have prepared a workaround sample based on the Grouping with Row drag and drop support. you can achieve that requirement by using rowDrop event and you can update the grid data source based on the row dragging to grouped column. Please refer to the below code example, documentation link and sample link for more information. 
let grid: Grid = new Grid( 
            dataSource: orderDetails, 
            allowRowDragAndDrop: true, 
            selectionSettings: { type: 'Multiple' }, 
            columns: [ 
                . . . . 
function rowDrop(arg){   
  let gObj: any = (<any>document.getElementById('Grid')).ej2_instances[0]; 
  let startedRow:any = arg.rows[0]; 
  let targetRow:any = arg.target.closest('tr');   
  if(targetRow.classList.contains('e-row') && targetRow.classList.length ){ 
     targetRow = targetRow; 
  } else{ 
    targetRow = arg.target.closest('tr').nextSibling; 
  let startRowIndex: number = parseInt(startedRow.getAttribute("aria-rowindex"),10); 
  let targetRowIndex: number = parseInt(targetRow.getAttribute("aria-rowindex"),10); 
  if(startRowIndex === targetRowIndex){ 
  let groupedCol:any = (gObj as any).groupSettings.columns; 
  for(let i:number=0,len:number=groupedCol.length;i< len; i++){ 
  let dataIndex: number = this.dataSource.indexOf(arg.data); 
  let value: any = this.currentViewData["records"][targetRowIndex][groupedCol[i]]; //update the group column value to dragging row data 
  this.currentViewData["records"][startRowIndex][groupedCol[i]] = value;    
  arg.cancel =true;  // prevent default action of rowDrop event  
Please get back to us, if you need further assistance. 
Pavithra S.  

ST Stefan Tmusic February 21, 2019 03:34 AM UTC


PS Pavithra Subramaniyam Syncfusion Team February 21, 2019 03:48 AM UTC

Hi Michal,  

Thanks for your update. 

Please contact us if you need any further assistance on this. As always, we will be happy to assist you.  

Pavithra S. 

ST Stefan Tmusic February 21, 2019 03:52 AM UTC

Could you solve the following issue?

Edit error when I use drag and drop on the Datagrid

As I use drag and drop within the grid, I used to get the following issue.
When I edit the cell I don't change its value, but it is changed as the prev cell value.

    <div id="app">
        <ejs-grid ref='grid' :load = 'load' :cellEdit="getCellEdit" gridLines='Both' :allowRowDragAndDrop="true" :toolbar='toolbar' :dataSource="data" :allowReordering='true' :dataBound='dataBound' :showColumnMenu='true' :allowResizing= 'true' :selectionSettings="selection" :filterSettings='filterSettings' :allowPaging="true" :allowSorting='true' :allowFiltering='true' :pageSettings='pageSettings' :editSettings='editSettings' >
              <e-column field='OrderID' headerText='Order ID' :isPrimaryKey='true' textAlign='Center' width=100></e-column>
              <e-column field='CustomerID' headerText='Customer ID' textAlign='Center' width=120></e-column>
              <e-column field='Freight' headerText='Freight' textAlign='Center' editType= 'numericedit' width=120></e-column>
              <e-column field='ShipCountry' headerText='Ship Country' textAlign='Center' editType= 'dropdownedit' width=150></e-column>
              <e-column field='OrderDate' headerText='Order Date' width='130' format="yMd" editType= 'datepickeredit'  type="date" textAlign='Center'></e-column>
import Vue from "vue";
import { GridPlugin,Selection,Toolbar , ColumnMenu, Reorder, Resize, RowDD, Page, Sort, Filter, Group, Aggregate ,Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
import $ from 'jquery';

let elem;

export default {
  data() {
    return {
      selection: { type: 'Multiple' },
      editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Batch'},
      pageSettings: { pageSizes:[5, 10, 20, 50], pageSize: 10 },
      toolbar: ["Search"],
      filterSettings: { type: 'Menu' },
      footerSum: function () {
        return  { template : Vue.component('sumTemplate', {
            template: `<span>Sum: {{data.Sum}}</span>`,
            data () {return { data: {data: {}}};}
  provide: {
    grid: [Page, Selection, ColumnMenu, Toolbar, RowDD,Resize, Sort, Edit ,Filter, Group,Reorder, Aggregate]
  methods: {
     load(args) {
      this.$refs.grid.$el.addEventListener('keydown', this.keyDownHandler);
    keyDownHandler(e) {
      if(e.keyCode) {
        let gridIns = this.$refs.grid.ej2Instances;
    dataBound: function() {
        this.$refs.grid.ej2Instances.columns[0].isPrimaryKey = true;
    getCellEdit: function () {
      // getSelectedRecords
    //  columnMenuClick: function(args) {
    //     if(args.item.id === 'gridclearsorting'){
    //         this.$refs.grid.clearSorting();
    //     }
    // }


<style lang="scss">

@import '../node_modules/@syncfusion/ej2-base/styles/material.css';  
@import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';  
@import '../node_modules/@syncfusion/ej2-calendars/styles/material.css';  
@import '../node_modules/@syncfusion/ej2-dropdowns/styles/material.css';  
@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';  
@import '../node_modules/@syncfusion/ej2-navigations/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import '../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css';
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";

PS Pavithra Subramaniyam Syncfusion Team February 22, 2019 10:36 AM UTC

Hi Michal, 
Greetings from the Syncfusion. 
We have validated the defect you have initiated with us. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our subsequent Patch release which will be rolled on 1st week of March 2019. If you wish to receive this fix in a specific prior release product version please contact Syncfusion Support (backwards compatibility subject to technological feasibility and our Support SLA) You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link https://www.syncfusion.com/feedback/4846/batch-edit-misbehaves-when-allowdraganddrop-enabled  
Pavithra S.  

ST Stefan Tmusic February 22, 2019 10:39 AM UTC

But would you give the answer now?
I need it asap.

PS Pavithra Subramaniyam Syncfusion Team February 27, 2019 12:14 PM UTC

Hi Michal, 
Based on your query we have prepared a sample with batch editing and row drag and drop features in the Essential JavaScript 2 Grid component. You can achieve the batch editing with row drag and drop by using cellSave event of Grid. Please refer the below code example for more information. 
var grid = new ej.grids.Grid({ 
        dataSource: window.orderDatas, 
        allowRowDragAndDrop: true, 
        selectionSettings: { type: 'Multiple' }, 
        editSettings: {allowEditing: true, allowDeleting: true, mode: "Batch", allowAdding: true}, 
        toolbar: ["Add", "Edit", "Delete", "Update"], 
        height: 400, 
        cellSave: function (args) { 
var tr = ej.grids.parentsUntil(args.cell, "e-row"); 
var cell = this.getRowObjectFromUID(tr.getAttribute('data-uid')).cells; 
if(this.columns.length < cell.length){ 
this.getRowObjectFromUID(tr.getAttribute('data-uid')).cells = this.getRowObjectFromUID(tr.getAttribute('data-uid')).cells.slice(1); 
        columns: [ 
        .  .  .   . 
Sample               : https://stackblitz.com/edit/ctqe4v?file=index.js 
Please get back to us, if you need further assistance. 
Pavithra S. 

PS Pavithra Subramaniyam Syncfusion Team June 10, 2019 06:26 PM UTC

Hi  Michal, 

Thanks for your patience. 

We are glad to announce that  we have included the fix  for the issue “Batch edit misbehaves when "allowDragAndDrop" enabled” in our Volume 1, SP1 2019 release (v17.1.48).  
Pavithra S. 

RP Rachman Pratama August 28, 2020 08:15 AM UTC

I have the same problem when use rowDragAndDrop with Grid.
I read your message that you guys already fixed this issue a year ago, but it still not working. i'm using the latest version.

TS Thiyagu Subramani Syncfusion Team August 31, 2020 09:26 AM UTC

Hi Rachman, 
Thanks for contacting Syncfusion forum. 

Based on your shared information we suspect that your reported issue is while enabling allowDragAndDrop and perform edit a cell and update, value of previous cell gets updated for the current cell. So we have prepared and checked sample as per your requirement. But unfortunately your reported issue doesn’t reproduced our side. Please refer to the below sample. 

If we misunderstood your requirement share below details which helps us, to provide appropriate solution as soon as possible. 

  1. Share issue reproducing sample or reproduce the issue in above sample.
  1. Video demonstration of your issue.

  1. Complete grid rendering code.

Please get back to us, if you need any further assistance. 

Thiyagu S. 

Live Chat Icon For mobile
Up arrow icon