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
close icon

How to reset a gridcontrol ?

Hi,

How can i reset a GridControl object ?
i.e. i want to reset a GridControl object to it's initial state
(the state when it was first allocated).

I'm using SyncFusion Essential Studio WPF 7.3.0.20

Thanks.

P.OM
Reportive SA

13 Replies

MS Mohamed Suhaib Fahad A. Syncfusion Team September 8, 2009 07:00 AM UTC

Hi Puthirak,

Thanks for using Syncfusion products. The GridControl works totally on how you define the styles, either through QueryCellInfo or manually setting those styles.

(1) Through QueryCellInfo, then you would have an underlying store, which you could simply set it to NULL and reset the Model.RowCount and Model.ColumnCount.

(2) Manually applying styles, then you simply clear the internal lists maintained in the Model as,

this.grid.Model..VolatileCellStyles.Clear();
this.grid.Model.Data.Clear();

Finally, you would have to force the grid to refresh,

this.grid.InvalidateCells();

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,


PO Puthirak OM September 8, 2009 11:17 AM UTC

Hi,

Thank you for your quick answer.
But unfortunately, it didn't help me solve my problem.

My problem concern the interaction between the selection
and the covered cell.

After several "reset" of the grid, the selection of the covered cell doesn't work properly, i.e. the selection doesn't cover all the covered cell.

I've join a code snippet where you can reproduce the problem.
You need to switch mode several time and play with the selection
between each switch.

Thanks,
P.OM
Reportive SA




CoveredCellAndSelection_81b215b9.zip


MS Mohamed Suhaib Fahad A. Syncfusion Team September 9, 2009 06:09 AM UTC

Hi Puthirak,

Thanks for the sample. The CoveredCells.Ranges had to be refreshed internally to make the selection work, We added a new method called InvalidateRanges(), that would clear out the CoveredCells.Ranges. For now, I added a workaround in your sample to make it work. If you need this fix, you can download the next week's development build that would be published in our website.

http://www.syncfusion.com/uploads/redirect.aspx?file=CoveredCellAndSelection_4afd4159.zip&team=development

Let me know if you need any more details.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,


PO Puthirak OM September 9, 2009 08:05 AM UTC

Hi,

Again thank you for your quick answer.
The file that you'd attached seems to be missing.
I'm looking forward to the next week build.

Thanks,
P.OM
Reportive SA


MS Mohamed Suhaib Fahad A. Syncfusion Team September 10, 2009 03:37 AM UTC

Hi,

I have uploaded the sample once again,

http://www.syncfusion.com/uploads/redirect.aspx?file=CoveredCellAndSelection_797c63da.zip&team=development

Please check with this.

Thanks,
Fahad


PO Puthirak OM September 10, 2009 07:58 AM UTC

Hi Fahad,

I've downloaded your modifications and it works.
Thanks again,

P.OM
Reportive SA


MS Mohamed Suhaib Fahad A. Syncfusion Team September 10, 2009 09:56 AM UTC

Hi Puthirak,

Thanks for your feedbacks.

Thanks,
Fahad


EG Evelyne Garcia November 5, 2009 04:39 PM UTC

Any equivalence of InvalidateCells(); in a GridDataControl?
By the way, I found amazing that the grid's display is stil working even if we destroy the ItemsSource.
Where can I find a real explanation of the GridDataControl behaviour?

Olivier


EG Evelyne Garcia November 5, 2009 04:51 PM UTC

Actually, I don't want to reset the grid, I just want to change its ItemsSource.
The amazing thing is that if change the ItemsSource, the grid is still linked to the old ItemsSource.


GK Ganesan K Syncfusion Team November 9, 2009 04:29 AM UTC

Hi Puthirak,

Thanks for your interest.

We have added the new property named “ClearAllOnItemSourceChange” in our latest RC build published in the below forum :

http://www.syncfusion.com/support/forums/general/91019/essential-studio-2009-vol4-rc-v74015-available-for-download.

You can clear all the link related to the Old ItemsSource by using this property. Use the below code for enable this property.

[Xaml]

x:Name="grid"
AutoPopulateColumns="True"
AutoPopulateRelations="False"
ClearAllOnItemSourceChange="True">


Please let us know if you need any more details.

Thanks
Ganesan.


SJ Scott Jeslis June 1, 2010 11:40 PM UTC

In 8.2 how do I reset the filter on a GridDataControl? I'm reusing the same GridDataControl object bound to a given class object (collection) which I then clear and repopulate as needed but the filktering stays intact.


VP Varun P Syncfusion Team June 4, 2010 03:52 AM UTC

Hi Scott,

Thanks for using Syncfusion products.

We created sample to reset the filter. Could you please download the sample from the following location ?

CS603807423-New-482023036.zip

Please let us know if you have any queries.

Thanks,
Varun


VP Varun P Syncfusion Team June 4, 2010 03:58 AM UTC

Hi Scott,

We are sorry for the inconvenience.

You can download the sample from the below location.

http://www.syncfusion.com/support/user/uploads/CS603807423-New-482023036.zip

Please let us know if you have any queries.

Thanks,
Varun

Loader.
Live Chat Icon For mobile
Up arrow icon