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

Data Grid Issue with grouped column

Hi all,i have an issue when i use grouped column.first time everything work well, on the second update of my ObservableCollection i have this errorUNHANDLED EXCEPTION:08-05 15:57:51.325 I/MonoDroid(23427): UNHANDLED EXCEPTION:08-05 15:57:51.425 I/MonoDroid(23427): System.NullReferenceException: Object reference not set to an instance of an object.08-05 15:57:51.425 I/MonoDroid(23427):   at Syncfusion.SfDataGrid.XForms.SfDataGrid+<>c__DisplayClass327_0.b__0 (Syncfusion.SfDataGrid.XForms.GroupColumnDescription col) [0x00016] in <3ea70b4f0fbc450a8acf949b35d96088>:0 08-05 15:57:51.425 I/MonoDroid(23427):   at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x0001b] in :0 08-05 15:57:51.425 I/MonoDroid(23427):   at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in :0 08-05 15:57:51.425 I/MonoDroid(23427):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.OnItemsSourceChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x000a8] in <3ea70b4f0fbc450a8acf949b35d96088>:0 08-05 15:57:51.425 I/MonoDroid(23427):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.BindableObject+SetValueFlags attributes, System.Boolean silent) [0x00108] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:592 08-05 15:57:51.425 I/MonoDroid(23427):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.BindableObject+SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:386 08-05 15:57:51.425 I/MonoDroid(23427):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:173 08-05 15:57:51.425 I/MonoDroid(23427):   at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:55 08-05 15:57:51.426 I/MonoDroid(23427):   at Xamarin.Forms.BindingExpression+BindingExpressionPart.b__47_0 () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:539 08-05 15:57:51.426 I/MonoDroid(23427):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in :0 08-05 15:57:51.426 I/MonoDroid(23427):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in :0 08-05 15:57:51.426 I/MonoDroid(23427):   at (wrapper dynamic-method) System.Object:e7740405-0f1a-402e-9148-cab20ed07d58 (intptr,intptr)08-05 15:57:51.464 W/art     (23427): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable08-05 15:57:51.476 D/Mono    (23427): DllImport searching in: '__Internal' ('(null)').08-05 15:57:51.476 D/Mono    (23427): Searching for 'java_interop_jnienv_throw'.08-05 15:57:51.476 D/Mono    (23427): Probing 'java_interop_jnienv_throw'.08-05 15:57:51.476 D/Mono    (23427): Found as 'java_interop_jnienv_throw'.if i remove grouped column every work well.Can you help me please?thanks

28 Replies

LU Luca August 5, 2017 02:10 PM UTC

i format it i little bit better....

08-05 16:09:30.853 I/MonoDroid(24298): UNHANDLED EXCEPTION:

08-05 16:09:30.902 I/MonoDroid(24298): System.NullReferenceException: Object reference not set to an instance of an object.

08-05 16:09:30.902 I/MonoDroid(24298):   at Syncfusion.SfDataGrid.XForms.SfDataGrid+<>c__DisplayClass327_0.<OnItemsSourceChanged>b__0 (Syncfusion.SfDataGrid.XForms.GroupColumnDescription col) [0x00016] in <3ea70b4f0fbc450a8acf949b35d96088>:0 

08-05 16:09:30.902 I/MonoDroid(24298):   at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x0001b] in <cc41d889a5b24501ae882a5cc55746dd>:0 

08-05 16:09:30.902 I/MonoDroid(24298):   at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <cc41d889a5b24501ae882a5cc55746dd>:0 

08-05 16:09:30.902 I/MonoDroid(24298):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.OnItemsSourceChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x000a8] in <3ea70b4f0fbc450a8acf949b35d96088>:0 

08-05 16:09:30.902 I/MonoDroid(24298):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.BindableObject+SetValueFlags attributes, System.Boolean silent) [0x00108] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:592 

08-05 16:09:30.902 I/MonoDroid(24298):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.BindableObject+SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:386 

08-05 16:09:30.902 I/MonoDroid(24298):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:173 

08-05 16:09:30.902 I/MonoDroid(24298):   at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:55 

08-05 16:09:30.902 I/MonoDroid(24298):   at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__47_0 () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:539 

08-05 16:09:30.902 I/MonoDroid(24298):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0 

08-05 16:09:30.902 I/MonoDroid(24298):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0 

08-05 16:09:30.902 I/MonoDroid(24298):   at (wrapper dynamic-method) System.Object:c703595d-c7f6-4af2-87dc-25e5fee83ea6 (intptr,intptr)

08-05 16:09:30.929 W/art     (24298): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable

08-05 16:09:30.936 D/Mono    (24298): DllImport searching in: '__Internal' ('(null)').

08-05 16:09:30.936 D/Mono    (24298): Searching for 'java_interop_jnienv_throw'.

08-05 16:09:30.936 D/Mono    (24298): Probing 'java_interop_jnienv_throw'.

08-05 16:09:30.936 D/Mono    (24298): Found as 'java_interop_jnienv_throw'.



VP Vimal Prabhu Manohkaran Syncfusion Team August 7, 2017 12:58 PM UTC

Hi Alberto,

Thanks for contacting Syncfusion Support. We are checking the reported issue based on the stack trace you have provided and were not able to replicate the issue. Could you please share the proper replication details regarding the features you have included , replication procedure, the operation you are performing when the crash is produced etc so that we can help you better and overcome your issue.

Regards,
Vimal Prabhu
 



LU Luca August 7, 2017 02:44 PM UTC

the app breaks when i do this for the 2 time:

Data= new ObservableCollection<view_data>(currentData.Data.Where(t => t.TYPE.ToUpper() == "PIPPO"));

and my datagrid is

 <syncfusion:SfDataGrid Grid.Row="3" Grid.Column="0" x:Name="dg" ColumnSizer="Star" AutoGenerateColumns="False"     VerticalOptions="FillAndExpand" HeightRequest="400"

                    ItemsSource="{Binding Data}" AllowGroupExpandCollapse="False" AutoExpandGroups="True" ScrollingMode="PixelLine" >

                        <syncfusion:SfDataGrid.GroupColumnDescriptions>

                            <syncfusion:GroupColumnDescription ColumnName="A_TYPE" />

                        </syncfusion:SfDataGrid.GroupColumnDescriptions>



VP Vimal Prabhu Manohkaran Syncfusion Team August 8, 2017 10:17 PM UTC

Hi Alberto,

Thank you for the update. We have prepared a sample based on the sample codes you have provided and recreated a crash with same stack trace as yours. Could you please download the sample from the below link and conform us whether this is the exact scenario of the crash in your application ? Crash replication procedure  for the sample in below link:
 1. Restore the nugets or add Syncfusion refrences and run the sample. (Initially the Grid loads with Itemsource as Collection_One with a property from Collection_One as the GroupedColumn. This renders the grid without any problem.)
 
 2. Click on the button titled “Button1” in the top of the screen ( we are clearing the group column descriptions collection and adding a new GroupColumnDescription with a property from the CollectionTwo ) 
3. Click on the button titled “Button2” (we are changing the ItemSource of the grid to Collection_2 when the application crashes ) 
 
Sample Link :  http://www.syncfusion.com/downloads/support/forum/131966/ze/Formstest62914072

If your replication of the issue or your scenario may differ, we kindly request you to modify the above sample to replicate the issue along with clear replication procedure.
 

Regards,
Vimal Prabhu
 



LU Luca August 28, 2017 09:52 PM UTC

hi,

yes i have the same error!

how can i fix it?

thanks



AN Ashok N Syncfusion Team August 29, 2017 10:25 AM UTC

Hi Alberto,  
  
Thanks for the confirmation.  
  
Already we had fixed this issue and this fix will be included in our 2017 Vol3 SP1 release, we will update you once release gets rolls out. We appreciate your patience until then.  
  
Regards,  
Ashok  



LU Luca September 3, 2017 01:59 PM UTC

hi,

after update now i have this error:

SortColumnDescription already exist in SfDataGrid.SortColumnDescriptions

thanks


LU Luca September 3, 2017 02:24 PM UTC

quick fix:

            this.dg.SortColumnDescriptions.Clear();


but it is only a workaround ;)




AN Ashok N Syncfusion Team September 4, 2017 09:28 AM UTC

Hi Alberto, 
 
Thanks for your update.  
 
We have checked the reported SortColumnDescription already exist issue with SfDataGrid v15.3.0.29 but we are not able to reproduce the reported issue with previously provided sample(August 8, 2017). Could you please check by clear your NuGet cache using below KB link, 
 
 
Still you are facing the issue, please do revert us by modifying our sample to replicate the issue or please share your sample along with replication procedure, that would be more helpful for us to proceed further.   
 
        
Regards, 
Ashok 



EM Emil September 27, 2017 11:06 PM UTC

reported issue is still occurring using latest version. please check it again. exact same scenario as OP reported causes this exception when raising changes on ObservableCollection second time or reordering using drag and drop feature. Please test it with drag and drop on grouped data and raise changed on model.

 @alberto: where do you do this exactly?  this.dg.SortColumnDescriptions.Clear();

I am using mvvm and i cant figure it out. if i use it. it returns me other error telling as below. probably because of I am getting this exception while doing drag and drop. 

09-28 02:03:31.989 I/MonoDroid(17490): UNHANDLED EXCEPTION:

09-28 02:03:32.017 I/MonoDroid(17490): System.NullReferenceException: Object reference not set to an instance of an object.

09-28 02:03:32.017 I/MonoDroid(17490):   at Syncfusion.SfDataGrid.XForms.GridRowDragDropController.EndDragging () [0x001b4] in :0 

09-28 02:03:32.017 I/MonoDroid(17490):   at Syncfusion.SfDataGrid.XForms.GridRowDragDropController.OnDragEnded () [0x00008] in :0 

09-28 02:03:32.017 I/MonoDroid(17490):   at Syncfusion.SfDataGrid.XForms.Droid.GridCellBaseRenderer.HandleTouchForRowDragAndDrop (Android.Views.MotionEvent e) [0x000d4] in :0 




EM Emil September 27, 2017 11:53 PM UTC

This can be easily reproduced using drag and drop feature on group HEADER. You should do it 2 times. first time it works for some reason but 2nd time doing it throws this exception. here is my datagrid

   


       

                          ItemsSource="{Binding WorkoutItems}"                     

                   AutoGenerateColumns="False"

                   AllowGroupExpandCollapse="True"

                   AllowSorting="False"

                      IsEnabled="True"

                   ColumnSizer="Star"

                   AllowSwiping="False"

                   AllowDraggingRow="True"

                  AllowDraggingColumn="False"                  

               

                    GridTapped="dataGrid_GridTapped"

                   SelectionMode="None"               

                 QueryRowHeight = "DataGrid_QueryRowHeight"            

               VerticalOptions="FillAndExpand" >

           

               

           

             

         

 

       

           

                               

                                  WinPhone="30"

                                  iOS="20"

                                  x:TypeArguments="x:Double" />

                           

           

               

                                     HeaderText="{resx:Translate Items,IsUpper=True}"

                                     MappingName="DisplayOrder">

                   

                       

                       Tablet="15"

                       x:TypeArguments="x:Double" />

                   


                   


                       

                           

                               

                           

                       


                   

               

           


       



DS Divakar Subramaniam Syncfusion Team September 28, 2017 03:25 PM UTC

Hi Emil, 
 
 
Sorry for the inconvenience caused. 
 
 
We have checked your query and we were able to reproduce the reported issue on our last release assemblies. However, the issue not reproduced in both our current source and the last release source. So, the issue might be in the shipped assemblies. Hence, the reported issue will be fixed in our upcoming 2017 Vol 3 SP2 release assemblies which will roll out by tomorrow. We appreciate your patience until then. 
 
 
Regards, 
Divakar. 



EM Emil replied to Divakar Subramaniam September 29, 2017 12:15 PM UTC

Hi Emil, 
 
 
Sorry for the inconvenience caused. 
 
 
We have checked your query and we were able to reproduce the reported issue on our last release assemblies. However, the issue not reproduced in both our current source and the last release source. So, the issue might be in the shipped assemblies. Hence, the reported issue will be fixed in our upcoming 2017 Vol 3 SP2 release assemblies which will roll out by tomorrow. We appreciate your patience until then. 
 
 
Regards, 
Divakar. 


Hi Divakar, 

I just updated to 2017 Vol 3 SP2 and cleared nuget cache, bin, obj, temp folders, rebuilt my application but Issue is not resolved. It is still crashing on second attempt of reordering SfDatagrid row. Can you please check ?

Exception message:

09-29 15:09:06.791 I/MonoDroid(21886): UNHANDLED EXCEPTION:

09-29 15:09:06.804 I/MonoDroid(21886): System.InvalidOperationException: SortColumnDescription already exist in SfDataGrid.SortColumnDescriptions

09-29 15:09:06.804 I/MonoDroid(21886):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.InitialSort () [0x000eb] in :0 

09-29 15:09:06.804 I/MonoDroid(21886):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.DeferRefresh () [0x0002c] in :0 

09-29 15:09:06.804 I/MonoDroid(21886):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.SetSourceList (System.Object source) [0x0000d] in :0 

09-29 15:09:06.804 I/MonoDroid(21886):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.OnItemsSourceChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x0026e] in :0 

09-29 15:09:06.804 I/MonoDroid(21886):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.BindableObject+SetValueFlags attributes, System.Boolean silent) [0x00108] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:592 

09-29 15:09:06.804 I/MonoDroid(21886):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.BindableObject+SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:386 

09-29 15:09:06.804 I/MonoDroid(21886):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:173 

09-29 15:09:06.804 I/MonoDroid(21886):   at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:55 

09-29 15:09:06.804 I/MonoDroid(21886):   at Xamarin.Forms.BindingExpression+BindingExpressionPart.b__47_0 () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:539 

09-29 15:09:06.804 I/MonoDroid(21886):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in :0 

09-29 15:09:06.804 I/MonoDroid(21886):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in :0 

09-29 15:09:06.804 I/MonoDroid(21886):   at (wrapper dynamic-method) System.Object:5abf7f4c-5675-45b2-9b3a-29809e2d3f11 (intptr,intptr)

thanks,

Emil



LU Luca September 29, 2017 12:47 PM UTC

hi ,sorry for delay.

my 'stupid' fix is this

  private void PkCountry_SelectedIndexChanged(object sender, EventArgs e)

        {

            this.dgBrand.SortColumnDescriptions.Clear();

        }



BT Burak Tugan September 30, 2017 02:24 PM UTC

The same error can be reproduced (on Syncfusion version 15.3.0.33 as well as on a couple of older versions) by having a grouped grid definition and assigning a data source to that grid twice in code. Syncfusion code inserts a sort column definition automatically on any grid that has a group definition every time the data source is refreshed. This is an internal bug.

Thank you for the bypass suggestion. Does Syncfusion support have an alternate bypass ? I assume we need to live with this until the October end update earliest.




EM Emil September 30, 2017 08:33 PM UTC

latest version is totally buggy. I could produce minimum 3 different exceptions as I reported with separate tickets (see my other tickets). I dont know how we can live with this. This feature is the most important feature I am using SfDatagrid over any other Listview.  



EM Emil replied to Alberto September 30, 2017 08:39 PM UTC

hi ,sorry for delay.

my 'stupid' fix is this

  private void PkCountry_SelectedIndexChanged(object sender, EventArgs e)

        {

            this.dgBrand.SortColumnDescriptions.Clear();

        }


Hi Alberto,

which event are you using? is it SelectionChanged event? I cant find any SelectedIndexChanged exposed on sfDatagrid?

thanks,

Emil



VP Vimal Prabhu Manohkaran Syncfusion Team October 2, 2017 09:49 AM UTC

Dear Customers,

We have checked for issues in the latest 2017 Volume 3 SP 2 dlls , in DragAndDrop along with Grouping enabled and we were not able to replicate any issue, crashes when row was dragged from one group to another and when group was dragged and dropped from one position to the other. We have also checked with clearing group column descriptions and changing itemsource in runtime and neither of which caused an exception. Please refer to the video recording of the same below.

Video Link : http://www.syncfusion.com/downloads/support/forum/131966/ze/ScreenCapture_02-Oct-17_2.43.59_PM1320485044

Sample Link : http://www.syncfusion.com/downloads/support/forum/131966/ze/Forms-1548677286

Please provide us with clear replication details on how to replicate the issue or please share with us the sample that can replicate the issue, without which we cannot proceed further. At moment we are still unclear on what your trying to achieve and when this exception is caused. Please revert us with the below details so that we can help you.
 
 
  1. What is your requirement and what hurdle are you facing in achieving it?
  2. When does this error occur ? What operations are you performing in sequence?
  3. What are all the features enabled in SfDataGrid ?
  4. Sample code or the sample itself replicating the issue
  5. Or modify our sample attached below so that the issue can be replicated .
 
We will resolve the issue for you the earliest if we could have all these details , which will enable us to proceed further. 

Regards,
Vimal Prabhu
 



EM Emil October 2, 2017 09:00 PM UTC

Dear Support team,

In your documentation on link below; it is claimed these 3 points below. see my comments with bold. I attach modified sample for repro.

https://help.syncfusion.com/xamarin/sfdatagrid/rowdraganddrop#dragging-scenarios

  • Records can be reordered to any position with auto scrolling.    this works fine
  • Groups position can be reordered using drag and drop. But no groups can be added inside other groups. this doesnt work unless you want to do it in memory and you should state it that you can only order it in memory but cannot commit changes to the underlying data
  • Data rows can be reordered within the same group or into the other groups as well. this doesnt work unless you want to do it in memory and you should state it that you can only order it in memory but cannot commit changes to the underlying data
 In the attached project, I extended ProductInfo model with DisplayOrder(int). I commented also 2 TODO lines. please enable each one by one and test them separately. 
1) Page1.xaml.cs ln:105 - this function updates model object with new order by updating displayorder after reordering. Then Raises Poperty changed on ObservableCollection of ProductInfo. I expect DisplayOrder should be updated in View
2) Page1.xaml.cs ln:146 This code is basically what you have on the link below. This is important if I am ordering within the same group (see point 3 above), but it throws another exception  https://help.syncfusion.com/xamarin/sfdatagrid/rowdraganddrop#reorder-the-underlying-data

Please let us know how can we continue from this?
thanks,
Emil

Attachment: Forms_e5abd2bd.7z


AN Ashok N Syncfusion Team October 4, 2017 06:52 PM UTC

Hi Emil, 
 
Thanks for your update. 
 
We have checked your query and In our UG document we have mentioned the reordering changes are made only in SfDataGrid.View and not in the underlying data. Thus the changes will be reverted when performing sorting, grouping or any other operation that refreshes the view. Reordering changes in the underlying data can be achieved by handling QueryRowDragging event in the sample side as explained below in Reordering underlying data. 
 
Regarding Issue 1: 
 
We have checked your sample and you are changing the collection in Drag ended. In DataGrid we do not change any view action while performing the UI action but you are trying to change the collection with Grouping so sorting also will applied to SfDataGrid so another UI action will get perform, this is not a DataGrid use case.  
 
Regarding Issue 2: 
 
You are reordering the records using getorder method, but need to set the delay for refresh the changes in view. We have modified the sample based on your requirement and attached in the below link, please refer it. 
 
 
Regards, 
Ashok 



LU Luca October 24, 2017 08:52 PM UTC

 hi all,

so finally how can fix this

System.InvalidOperationException: SortColumnDescription already exist in SfDataGrid.SortColumnDescriptions

?

the problem is that in yor example you click a button in order to SortColumnDescriptions, but i have to do in the viewmodel, or each time i update the collection.

thanks



AN Ashok N Syncfusion Team October 25, 2017 05:04 PM UTC

Hi Alberto, 
 
We have checked the reported issue and if we added the new SortColumnDescription with same name of already sorted column, the application was crash, we have throws this exception. So please confirm your side whether you are adding new SortColumnDescription column name was already not sorted? If you want to add the new SortColumnDescription to already added column, please clear that SortColumnDescription using SortColumnDescriptions.Clear method. Still you are facing the same issue please modified the below attached sample based on your requirement and revert to us, that would be more helpful for proceed further. 
In our sample we have added two different sort description and changed the collection in runtime , also added sort description based on the new collection. 
 
 
Regards, 
Ashok 



LU Luca October 26, 2017 11:49 AM UTC

hi,

i'm not adding a new sort column, i'm just updating the ObservableCollection to a grid with GroupColumnDescriptions.

The problem is that i'm using viewmodel so i can't call clear command .

can you help me.. so i'd like to call clear command before update of collection



AN Ashok N Syncfusion Team October 27, 2017 09:44 AM UTC

Hi Alberto, 

Thanks for your update. In our SfDataGrid if we change the collection, SfDataGrid will clear previously added Group column and sort column. We have tested this in SfdataGrid v15.3.0.33 release and all cleared while change the collection and newly added Group column has been added properly with sorting, could you please confirm whether you are able to reproduce the issue with this version? 

If you want to get the SfDataGrid in your ViewModel class , please pass our SfDataGrid is as a CommandParameter to a button, please refer the below KB link to get more detail about this command binding. 

If your requirement is differ from this and still you are facing the issue please modified the below attached sample based on your requirement and revert to us with detail replication procedure, that would be more helpful for proceed further.  


Regards, 
Ashok 



LU Luca October 27, 2017 10:37 AM UTC

i can't understand why,

i'm using your same version and i get always this


10-27 12:36:23.830 I/MonoDroid(26172): System.InvalidOperationException: SortColumnDescription already exist in SfDataGrid.SortColumnDescriptions

10-27 12:36:23.830 I/MonoDroid(26172):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.InitialSort () [0x000eb] in :0 

10-27 12:36:23.830 I/MonoDroid(26172):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.DeferRefresh () [0x0002c] in :0 

10-27 12:36:23.830 I/MonoDroid(26172):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.SetSourceList (System.Object source) [0x0000d] in :0 

10-27 12:36:23.830 I/MonoDroid(26172):   at Syncfusion.SfDataGrid.XForms.SfDataGrid.OnItemsSourceChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x0026e] in :0 

10-27 12:36:23.830 I/MonoDroid(26172):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00108] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:596 

10-27 12:36:23.830 I/MonoDroid(26172):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindableObject.cs:390 

10-27 12:36:23.830 I/MonoDroid(26172):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindingExpression.cs:174 

10-27 12:36:23.830 I/MonoDroid(26172):   at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindingExpression.cs:56 

10-27 12:36:23.830 I/MonoDroid(26172):   at Xamarin.Forms.BindingExpression+BindingExpressionPart.b__47_0 () [0x00000] in C:\agent\_work\3\s\Xamarin.Forms.Core\BindingExpression.cs:551 

10-27 12:36:23.830 I/MonoDroid(26172):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in :0 

10-27 12:36:23.830 I/MonoDroid(26172):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in :0 

10-27 12:36:23.830 I/MonoDroid(26172):   at (wrapper dynamic-method) System.Object:f0ee84ee-977a-462d-913e-a7d7e4a8afd9 (intptr,intptr)

10-27 12:36:23.855 W/art     (26172): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable

10-27 12:36:23.862 D/Mono    (26172): DllImport searching in: '__Internal' ('(null)').

10-27 12:36:23.862 D/Mono    (26172): Searching for 'java_interop_jnienv_throw'.

10-27 12:36:23.862 D/Mono    (26172): Probing 'java_interop_jnienv_throw'.

10-27 12:36:23.862 D/Mono    (26172): Found as 'java_interop_jnienv_throw'.

An unhandled exception occured.


10-27 12:36:24.576 E/mono    (26172): 

10-27 12:36:24.576 E/mono    (26172): Unhandled Exception:

10-27 12:36:24.576 E/mono    (26172): System.InvalidOperationException: SortColumnDescription already exist in SfDataGrid.SortColumnDescriptions

10-27 12:36:24.576 E/mono-rt (26172): [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: SortColumnDescription already exist in SfDataGrid.SortColumnDescriptions




AN Ashok N Syncfusion Team October 30, 2017 11:43 AM UTC

Hi Alberto,       
   
A support incident has been created under your account to track the status of this. Please log on to our support website to check for further updates       
       
Regards,       
Ashok      



LU Luca November 21, 2017 09:35 PM UTC

hi,
so is this close?
thanks


AN Ashok N Syncfusion Team November 23, 2017 06:50 PM UTC

Hi Alberto, 
 
Since, this is a public forum, so all users able to view about this forum. We request you to follow about your query from that created incident. 
 
Regards, 
Ashok 


Loader.
Live Chat Icon For mobile
Up arrow icon