I know that there are many forum posts regarding filtering but I am having the hardest time trying to figure out how to accomplish this filter scenario:
I have 4 columns, Rdel, RAdd, RMod, RErr.
right now I have those columns set as Integer type in my datatable that I bind to the radgridview. I handle changhing the values as need be but I need to be able to use filters so that I can not rows. The way I have been trying to set the filters up I have used a custom context menu that uses a check type menuitem. So when that value changes I am trying to add or remove descriptors. So I may have many or no filters applied to the grid. Right now I have something like this and it sort of works but I just wanted to kbnow if there is a better way of doing this.
If there is a better way to handle this scenario I would appreciate any suggestions. The main thing is that I will add and remove filters on a single column and not want to lose the existing ones. I would also need to be able to only see the rows that have a 1 in any of those columns. A row could have a 1 in conAdded, conModified, and conDeleted. That is so I can undo a single operation, such as a delete and still know that row was added.
Thanks once again.
Nick
I have 4 columns, Rdel, RAdd, RMod, RErr.
right now I have those columns set as Integer type in my datatable that I bind to the radgridview. I handle changhing the values as need be but I need to be able to use filters so that I can not rows. The way I have been trying to set the filters up I have used a custom context menu that uses a check type menuitem. So when that value changes I am trying to add or remove descriptors. So I may have many or no filters applied to the grid. Right now I have something like this and it sort of works but I just wanted to kbnow if there is a better way of doing this.
Public Const conMODIFIED As String = "RMod"
Public Const conADDED As String = "RAdd"
Public Const conDELETED As String = "RDel"
Public Const conERRORROW As String = "RErr"
Public Const conCHANGESLINK As String = "RCHGS"
Public Const conROWID As String = "iRowID"
Public Const conLSGRDTYPE As String = "lsGrdDataType"
Public Const conCHFLAG As Integer = 1 '"x"
Public Const conUCHFLAG As Integer = 0 '""
Public Sub ViewRowStates(Optional ByVal UnchangedRows As Boolean = True, Optional ByVal ChangedRows As Boolean = True, _
Optional ByVal AddedRows As Boolean = True, Optional ByVal DeletedRows As Boolean = True, _
Optional ByVal ErrorRows As Boolean = False)
Me.FilterDescriptors.Remove(conADDED)
Me.FilterDescriptors.Remove(conMODIFIED)
Me.FilterDescriptors.Remove(conDELETED)
Me.FilterDescriptors.Remove(conERRORROW)
Dim cFilter As New Telerik.WinControls.Data.CompositeFilterDescriptor
If Not UnchangedRows Then
Dim compFilter As New Telerik.WinControls.Data.FilterDescriptor
compFilter.PropertyName = conMODIFIED
compFilter.Operator = Telerik.WinControls.Data.FilterOperator.IsEqualTo
compFilter.Value = conCHFLAG
compFilter.IsFilterEditor = True
cFilter.FilterDescriptors.Add(compFilter)
End If
If Not ChangedRows Then
Dim compFilter As New Telerik.WinControls.Data.FilterDescriptor
compFilter.PropertyName = conMODIFIED
compFilter.Operator = Telerik.WinControls.Data.FilterOperator.IsNotEqualTo
compFilter.Value = conCHFLAG
compFilter.IsFilterEditor = True
cFilter.FilterDescriptors.Add(compFilter)
End If
If Not AddedRows Then
Dim compFilter As New Telerik.WinControls.Data.FilterDescriptor
compFilter.PropertyName = conADDED
compFilter.Operator = Telerik.WinControls.Data.FilterOperator.IsNotEqualTo
compFilter.Value = conCHFLAG
compFilter.IsFilterEditor = True
cFilter.FilterDescriptors.Add(compFilter)
End If
If Not DeletedRows Then
Dim compFilter As New Telerik.WinControls.Data.FilterDescriptor
compFilter.PropertyName = conDELETED
compFilter.Operator = Telerik.WinControls.Data.FilterOperator.IsNotEqualTo
compFilter.Value = conCHFLAG
compFilter.IsFilterEditor = True
cFilter.FilterDescriptors.Add(compFilter)
End If
If Not ErrorRows Then
Dim compFilter As New Telerik.WinControls.Data.FilterDescriptor
compFilter.PropertyName = conERRORROW
compFilter.Operator = Telerik.WinControls.Data.FilterOperator.IsNotEqualTo
compFilter.Value = conCHFLAG
compFilter.IsFilterEditor = True
cFilter.FilterDescriptors.Add(compFilter)
End If
Me.FilterDescriptors.Add(cFilter)
End Sub
If there is a better way to handle this scenario I would appreciate any suggestions. The main thing is that I will add and remove filters on a single column and not want to lose the existing ones. I would also need to be able to only see the rows that have a 1 in any of those columns. A row could have a 1 in conAdded, conModified, and conDeleted. That is so I can undo a single operation, such as a delete and still know that row was added.
Thanks once again.
Nick