Declined
Last Updated: 15 Sep 2015 13:40 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 12 Feb 2015 14:52
Category: GridView
Type: Bug Report
0
FIX. RadGridView - when applying a composite filter programmatically, there is no indication in the header cell that a filter is applied
To reproduce: use the following code snippet:
Sub New()
    InitializeComponent()

    Me.RadGridView1.EnableFiltering = True
    Me.RadGridView1.ShowHeaderCellButtons = True

    Dim dt As New DataTable
    dt.Columns.Add("Id", GetType(Integer))
    dt.Columns.Add("Name", GetType(String))
    dt.Columns.Add("Type", GetType(String))
    dt.Columns.Add("Active", GetType(Boolean))

    Dim typeList As New List(Of String)
    typeList.Add("REFERRAL")
    typeList.Add("EMPLOYEE")
    typeList.Add("Type3")
    typeList.Add("Type4")

    Dim rand As New Random
    For index = 1 To 10
        dt.Rows.Add(index, "Name" & index, typeList(rand.Next(0, typeList.Count)),If(index mod 2=0, True,false))
    Next

    Me.RadGridView1.AutoGenerateColumns = False
    Dim decimalColumn As New GridViewDecimalColumn("ID")
    decimalColumn.FieldName = "Id"
    RadGridView1.MasterTemplate.Columns.Add(decimalColumn)

    Dim textBoxColumn As New GridViewTextBoxColumn("Name")
    textBoxColumn.FieldName = "Name"
    RadGridView1.MasterTemplate.Columns.Add(textBoxColumn)

    Dim supplierColumn As GridViewComboBoxColumn = New GridViewComboBoxColumn("Type")
    supplierColumn.FieldName = "Type"
    supplierColumn.DataSource = typeList
    Me.RadGridView1.Columns.Add(supplierColumn)

    Dim checkBoxColumn As New GridViewCheckBoxColumn("Active")
    checkBoxColumn.FieldName = "Active"
    RadGridView1.MasterTemplate.Columns.Add(checkBoxColumn)

    Me.RadGridView1.DataSource = dt
    Me.RadGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill

End Sub

Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click

    Dim activeFilter As New FilterDescriptor()
    activeFilter.PropertyName = "Active"
    activeFilter.Operator = FilterOperator.IsEqualTo
    activeFilter.Value = True

    Dim typeFilter As New CompositeFilterDescriptor()
    typeFilter.FilterDescriptors.Add(New FilterDescriptor("Type", FilterOperator.IsEqualTo, "EMPLOYEE"))
    typeFilter.FilterDescriptors.Add(New FilterDescriptor("Type", FilterOperator.IsEqualTo, "REFERRAL"))
    typeFilter.LogicalOperator = FilterLogicalOperator.Or

    Dim overallFilterDescriptor As New CompositeFilterDescriptor()
    'overallFilterDescriptor.PropertyName = "Type"
    'overallFilterDescriptor.IsFilterEditor = True

    overallFilterDescriptor.FilterDescriptors.Add(typeFilter)
    overallFilterDescriptor.FilterDescriptors.Add(activeFilter)
    overallFilterDescriptor.LogicalOperator = FilterLogicalOperator.And

    Me.RadGridView1.FilterDescriptors.Add(overallFilterDescriptor)
End Sub


Run the project and click the button. You will see that the filter button is not orange indicating that there is applied filter. Additionally, the "Clear filter" option is disabled and the user is not allowed to see the entire data any more.

Workaround: set the overall CompositeFilterDescriptor.PropertyName to a specific column and the IsFilterEditor property to true. Thus, you will be allowed to clear the filter from this column.
Attached Files:
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
1 comment
ADMIN
Ivan Petrov
Posted on: 11 Aug 2015 14:02
Composite filters can be build into trees of composite filters and include any number of columns from the grid on any given level of the filter hierarchy. This type of hierarchical filters cannot be presented clearly or at all to the user in the grid UI.