syncfusion / angular-ej1-demos

This repository contains the demos of Syncfusion Essential JS 1 Angular Components.
https://www.syncfusion.com/jquery/angular-ui-components?utm_source=github&utm_medium=listing
0 stars 1 forks source link

angular ej1 grid: dragAndDrop #1

Open ninopetrovic opened 5 years ago

ninopetrovic commented 5 years ago

Hello,

I implemented a grid in my website with dragAndDrop enabled and it works fine. But, i dont like that i have to select the row first before draging it to wanted position. if i just try to drag it, it instantly goes to multiselecting rows. If i try to disable multiselect it does't do anything.

B.R. Nino Petrovic

VigneshNatarajan27 commented 5 years ago

Hi Nino

We understand that you need to prevent the multiselection on dragging the mouse and drop the row in selected index without selecting the record. We have achieved your requirement using rowDragStart event of ejGrid. In that event we have selected the dragged row. So that dragged element can be dropped properly at specific index.

<ej-grid #grid [dataSource]="gridData" (rowDragStart)="onRowDragStart($event)">

onRowDragStart(e: any){ 
     this.Grid.widget.selectRows(e.target.index()); 
}

Refer the below link for the JS playground sample

Sample: https://jsplayground.syncfusion.com/kgcjrd0i

Refer the API documentation for your reference

https://help.syncfusion.com/api/angular/ejgrid#methods:selectrows

https://help.syncfusion.com/api/angular/ejgrid#events:rowdragstart

Regards, Vignesh Natarajan

ninopetrovic commented 5 years ago

Hello Vignesh,

Thank you! Your solution works for me.

Best regards, Nino Petrovič