Hi,
In our application we allow users to save customizations they have made to a grid to a database. The issue we have is that the fields in that grid are always changing and whenever a field is dropped from the field layout definition this then breaks all the saved customizations. We either have to manually go in and tweak all the XML in the database or we have to ask the users to create their saved view again. As you can imagine, neither is a particularly satisfying solution.
Is there a way we can make LoadCustomizations not fall over when a column no longer exists? And if not, can this be raised as a feature request to allow the method to ignore missing fields.
(Let me know if you require a sample attachment but it is quite simple to recreate yourself. Create a grid with two fields and extend the column width of both. Save the customization xml. Then delete one of the field definitions, reload the app and attempt to load the customization xml and it will not apply the column width to the column that does still exist).
thanks,
Karan
HI Karan,
I followed your steps and reproduced your issue.
I will bring this to the attention of our developers.
Sincerely, Matt Developer Support Engineer
HI,
This is not bug,
The Load/Save Customization methods are designed to load and save end user customizations to the grid. Since removing a Field from the FieldLayout definition is not something the end user can do, the Load/Save customizations feature does not track this activity. That said, if the end user hides a field using the field chooser dialog the Load/Save feature will track that and restore the visibility of the field when LoadCustomizations is called
I will create a feature request for this issue.
I am attaching a sample project that contains a workaround for this issue.
Hi Matt,
Thanks for your help. I tried the sample project and can see it works in there but unfortunately when I tried to use the workaround in our project it did not work and instead the grid would just go blank (all column headers removed). The difference is that in our project we specify the fieldlayout in xaml (because we apply certain styles to columns and use value converters etc.).
Attaching a modified version of your sample project which has the grid xaml definition like ours and you can see the issue. Any chance there is a workaround for this scenario?
HI ,
Instead of removing the field, you could change its visibility to collapsed.
Here is a code snippet
xamDataGrid1.FieldLayouts[0].Fields[0].Visibility = System.Windows.Visibility.Collapsed;
I made this change to the sample and it worked.
I;ve attached the sample.
Sincerely,Matt
I am just following up on this forum thread.
Please let me know if I can provide further assistance.
That workaround helps. We bind to a DTO and don't have complete control over its contents so sometimes fields will be removed from there and conversely we have to remove from field layout definitions else the binding breaks. However, at least we know that by not deleting the field from the DTO and by setting the visibility of the field layout definition we can avoid invalidating saved profiles.
I still hope in future release the grid can handle missing field layouts though.
Thanks for your help,
If you have additional questions regarding this feature, you should contact our Developer Support Manager: dsmanager@infragistics.com
Sincerely,
MattDeveloper Support Engineer
I also need solution of same problem. Can we get this feature in next release.
BR
Nadeem
we have the same problem like Karan (we use Version 11.1).What about the feature request?Is ther a plan to release that feature?Thanks for your feedback.
Best regards,Christine
H iKaran,
Thanks for your feedback. A feature request has been submitted for this issue.