Is it possible not to expand automatically GroupDropArea when you drag a column to it when it's closed?

Hi,

if I have an SfDataGrid when I enable grouping but I have GroupDropArea closed, as soon as the user clicks on a column and drags it very little toward the GroupDropArea, even if he does not want to group on that column (say, for example, he only wanted to sort on that column), the GroupDropArea ia automatically opened and the grid is grouped on that column.
I'd like, instead, that the column is added to GroupDropArea ONLY if GroupDropArea is opened and not it is automatically opened if it's closed.
Is it possible to obtain such a behavior ?
Thanks.

3 Replies

JG Jai Ganesh S Syncfusion Team November 13, 2017 05:03 PM UTC

 
We have checked your query with our sample. While we start to drag the GridHeadercolumn the GropDropArea will be opened automatically. This is the default behavior of SfDataGrid. If you don’t want to do the grouping then you can set the ShowGroupDropArea as false in SfDataGrid.  
 
Otherwise if you want the grouping and don’t want to open the GroupDropArea while drag the header then you can customize the GridColumnDragDropController and set the GropDropArea expanded as false, 
 
public class CustomDragDropController : GridColumnDragDropController 
{ 
    SfDataGrid datagrid; 
    public CustomDragDropController(SfDataGrid dataGrid) : base(dataGrid) 
    { 
        datagrid = dataGrid; 
    } 
 
    protected override void OnPopupContentPositionChanged(double HorizontalDelta, double VerticalDelta, Point mousePointOverGrid) 
    { 
        (this.datagrid.DataContext as ViewModel).IsExpanded = this.datagrid.IsGroupDropAreaExpanded; 
 
        base.OnPopupContentPositionChanged(HorizontalDelta, VerticalDelta, mousePointOverGrid); 
        var groupDropAreaMethod = this.datagrid.GetType().GetProperty("GroupDropArea", BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic); 
 
        var groupDropArea = groupDropAreaMethod.GetValue(this.datagrid); 
 
        if(!(this.datagrid.DataContext as ViewModel).IsExpanded) 
            (groupDropArea as GroupDropArea).IsExpanded = false; 
        else 
            (groupDropArea as GroupDropArea).IsExpanded = true; 
    } 
} 
 
 
 
Regards, 
Jai Ganesh S 



SI Silvio November 14, 2017 08:37 AM UTC

Thank you very much for your sugestion ..




JG Jai Ganesh S Syncfusion Team November 14, 2017 12:24 PM UTC

 
Thank you for the update. 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Jai Ganesh S

Loader.
Up arrow icon