Posted 30 May 2019, 8:15 am EST
We have a custom DateTimeCellType that translates long values into dates (don’t ask, it’s an old system).
When we use the custom celltype in our grid it works fine for displaying the date values and sorting the column, however, the filter dropdown for the custom column is empty (shows none of the cell values), except for the default “(All)” and “(Blanks)” items.
How do we have to modify our custom celltype (code below) to work with filtering?
Thanks. – Paul
Public Class MCS_DateTimeCellType_ConvertLongToDate
Inherits FarPoint.Win.Spread.CellType.DateTimeCellType
Private WithEvents Editor As New FarPoint.Win.Spread.CellType.GeneralEditor
Public Overrides Function GetEditorControl(ByVal appearance As FarPoint.Win.Spread.Appearance, ByVal zoomFactor As Single) As System.Windows.Forms.Control
' Setting the Static property does NOT work for the first cell double-clicked on.
' It will still enter edit mode.
' However, as suggested by C1, setting the editor to NOTHING does the trick.
' Me.Static = True
Return Nothing ' Me.Editor
End Function
Public Overrides Sub PaintCell(g As Graphics, r As Rectangle, appearance As FarPoint.Win.Spread.Appearance, value As Object, isSelected As Boolean, isLocked As Boolean, zoomFactor As Single)
Dim brushBackground As Brush
Dim dteValue As Date
If value = 0 Then
' Draw a blank rectangle in the cell.
brushBackground = New SolidBrush(appearance.BackColor)
g.FillRectangle(brushBackground, r)
Else
dteValue = Mcs.ConvertDateFromLong(value)
MyBase.PaintCell(g, r, appearance, dteValue, isSelected, isLocked, zoomFactor)
End If
End Sub
End Class