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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Drag/drop between tables with a master grid

Thread ID:

Created:

Updated:

Platform:

Replies:

143666 Mar 30,2019 09:11 PM UTC Apr 1,2019 11:32 AM UTC Angular - EJ 2 1
loading
Tags: Grid
Tareq Perez
Asked On March 30, 2019 09:11 PM UTC

Hello, 
I am trying to get drag and drop between two grids where the source grid does not remove the row on drop. I want to maintain a master list of data and allow the user to drop data from it without modifying that source grid.

 This is my current setup, but on drop it transfers the row from the source grid to the destination grid. Is there a way to maintain the source grid on drop?

<div class="row">
<div class="col-sm-6">
<ejs-grid id='DestGrid' #destGrid [dataSource]='practiceModifiers' [allowSelection]="true"
[allowRowDragAndDrop]="true"
[selectionSettings]="{ type: 'Multiple' }">
<e-columns>
<e-column headerText="Available Modifiers">
<ng-template #template let-data>
<div>
<span>{{ data | formatModifierInfo }}</span>
</div>
</ng-template>
</e-column>
</e-columns>
</ejs-grid>
</div>
<div class="col-sm-6">
<ejs-grid id='SourceGrid' #sourceGrid [dataSource]='masterModifiers' [allowSelection]="true"
[allowRowDragAndDrop]="true" [selectionSettings]="{ type: 'Multiple' }"
[rowDropSettings]="{ targetID: 'DestGrid' }">
<e-columns>
<e-column headerText="Practice Modifiers">
<ng-template #template let-data>
<div>
<span>{{ data | formatModifierInfo }}</span>
</div>
</ng-template>
</e-column>
</e-columns>
</ejs-grid>
</div>
</div>

Pavithra Subramaniyam [Syncfusion]
Replied On April 1, 2019 11:32 AM UTC

Hi Tareq, 
 
Greetings from Syncfusion. 
 
We have created a sample based on your requirement. Here, we have maintained rows in source grid while drop the rows on destination grid. Please find the below code example and sample for your reference. 
 
[code example] 
... 
export class DragAndDropComponent implements OnInit { 
  ... 
 public flag: boolean = true;  
 
  ngOnInit(): void { 
    this.srcData = orderDetails; 
    ... 
 } 
 
  rowDrop(args: any) { 
    this.idx = args.fromIndex; 
    this.dta = args.data; 
  } 
 
  rowDragStart(args: any){ 
    this.flag = true; 
  } 
 
  actionBegin(args: any) { 
    if (args.requestType == "rowdraganddrop") { 
      if (this.flag === true) { 
        this.flag = false; 
        this.grid.notify("rows-added", { toIndex: this.idx, records: this.dta }); 
        this.grid.notify('model-changed', { 
          type: 'actionBegin', requestType: 'rowdraganddrop' 
        }); 
      } 
    } 
  } 
 
} 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Pavithra S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;