GridView does not cache values of an unbound column, because it is impossible to determine when the cache should be cleared automatically. GridView just displays values provided by the CustomUnboundColumnData event. So, to display a specific value in a cell, you need to pass a corresponding value to the e.Value parameter based on a processed column and row. What you return as the e.Value parameter is what is displayed in GridView. Each time a cell needs to be updated, the CustomUnboundColumnData event is called.
This example demonstrates how a simple caching mechanism can be implemented. In this project, you can perform all supported operations with GridView, such as sorting/deleting/adding records, and the unbound column will display proper values. This is because values of the ID column are used as key values. This column is readonly and contains only unique values. So, rows can be always identified.
Question Comments
Added By: Boris Soto at: 11/24/2012 3:13:02 PM
When using code I get following error
Error 1 'InitializeComponent' is not declared. It may be inaccessible due to its protection level. C:\Users\Boris\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 32 13 WindowsApplication1
Error 2 'gridControl1' is not declared. It may be inaccessible due to its protection level. C:\Users\Boris\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 34 13 WindowsApplication1
Error 3 'gridView1' is not declared. It may be inaccessible due to its protection level. C:\Users\Boris\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 38 37 WindowsApplication1
Error 4 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. C:\Users\Boris\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 44 156 WindowsApplication1
Please advice
i tried but was not sucessfull when is this
Private Sub gridView1_CustomUnboundColumnData(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs) Handles gridView1.CustomUnboundColumnData
If e.IsGetData Then
e.Value = _Cache.GetValue(e.Row)
End If
If e.IsSetData Then
_Cache.SetValue(e.Row, e.Value)
End If
End Sub
called do and how
As I can see, you've created a separate ticket on this subject. I've moved your comment there. Let's continue our discussion in that thread.Added By: Johnathon Harkness at: 1/5/2015 9:44:49 AM
Hi are there any examples of this using an xpcollection of xpobjects as the datasource?
Added By: Dimitros (DevExpress Support) at: 1/6/2015 3:24:00 AMHello Johnathon ,
To process your recent post more efficiently, I created a separate ticket on your behalf: T193371: Unbound column - how to use with XPCollection. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.