Save SfDatagrid settings

Hello

Is it possible to save specific user settings of the grid in a database or settings file

For example grid with 3 columns

User 1 wants to see column order : column1, column2 column3
User 2 wants to see column order : column3, column1, column2

this is possible but the next time user2 starts he has to swith the columns again …
can we save this settings (also possible for sorting and filters?) per user and load them again the next time the user start up.

So every user can save his personal grid settings

Thanks
Wheel 

6 Replies

MA Mohanram Anbukkarasu Syncfusion Team June 12, 2018 12:46 PM UTC

Hi Chris,  
 
Thanks for contacting Syncfusion support. 
 
To save and load the grid settings you can use the Serialization and Deserialization support in the SfDataGrid.  
 
You can save the columns, sorting and filter settings by enabling the corresponding options in the SerializationOptions of the Serialize method in SfDataGrid. 
As well as the saved settings can be loaded to the grid by enabling the same options in DeserializationOptions of the Deserialize method. 
 
Please refer the below UG link for more details. 
 
Regards, 
Mohanram A. 



CV Chris Vandewiele June 12, 2018 01:08 PM UTC

Thanks

Perfect 
I will use this certainly to make sfdatagrid settings saved for every user
A lot to test :-) 

Thanks
Wheel 


CV Chris Vandewiele June 12, 2018 02:46 PM UTC

Hello

I have tried to use de serialisation deserialisation code in my project and heve 2 additional problems
See my project i want to replace top default microsoft datagridview component with sfdatagrid on the bottom.
I added 2 buttons in the topleft corner of the screen to save and get settings of my sfdatagrid with following code (see view1.png,)

    Private Sub btnSaveSettings_Click(sender As Object, e As EventArgs) Handles btnSaveSettings.Click
        Using file = System.IO.File.Create("DgSfSelection.xml")
            Me.DgSfSelection.Serialize(file)
        End Using
    End Sub
    Private Sub btnGetSettings_Click(sender As Object, e As EventArgs) Handles btnGetSettings.Click
        Using file = System.IO.File.Open("DgSfSelection.xml", System.IO.FileMode.Open)
            Me.DgSfSelection.Deserialize(file)
        End Using
    End Sub

This works fine i group per status (see view.png) and save the settings in the xml file. Then i delete the grouping and then i Get the settings from xml.
And the grouping reappears.
One problem My Syncfusion.WinForms.DataGrid.GridImageColumn() are showing no images they show system.byte??? see view.jpg
How can i solve this?

Second problem: when i stop the program and restart. Then the normal grid is shown (without the grouping). then i want to get the settings and get an exception
TargetInvocationException. See view4.png and TargetInvocationException.txt. What am i doing wrong here?


Thanks
Wheel

Attachment: TargetInvocationException_bbe9d816.zip


MA Mohanram Anbukkarasu Syncfusion Team June 13, 2018 11:29 AM UTC

Hi Chris,  
 
Thanks for your update. 
 
Query 
Response 
Image column is not deserializing  
We were able to reproduce the issue in our end. The fix for this issue will be available in our Volume 2, 2018 SP1 release which is expected to be released in the middle of July, 2018. 
TargetInvocationException thrown when restart the application and reload the settings 
This issue is a known one and it is already fixed in our  Volume  1, 2018  SP1 release. (16.1.0.32) 
 
 
 
Regards, 
Mohanram A. 



CV Chris Vandewiele June 15, 2018 01:33 PM UTC

Hello

I have installed last version .37 and indeed 'TargetInvocationException' problem is solved 
Looking forward to the solution for 'Image column is not deserializing'

Thanks
Wheel


MA Mohanram Anbukkarasu Syncfusion Team June 18, 2018 05:03 AM UTC

Hi Chris, 

Thanks for your update. 

As we have updated earlier, the fix for the issue in deserializing the Image column will be available in our Volume 2 2018 SP1 release. 

Regards, 
Mohanram A. 


Loader.
Up arrow icon