C1DataGrid C1AdvancedFiltersBehavior ... like excel

Posted by: bernd.havla on 13 November 2018, 8:12 pm EST

    • Post Options:
    • Link

    Posted 13 November 2018, 8:12 pm EST

    Using the C1AdvancedFiltersBehavior in the datagrid:

    After filtering the first column: we get less data as excpected, all fine.

    But when we filter the next column: we can set the filter over all data in the datatable and not - as the user would expect: the next filter depends on the filter(s) before!

    Is there any property to set this behavior or can this be changed?

    Many thanks and bet regards,

    Bernd

  • Posted 14 November 2018, 4:45 pm EST

    Hi Bernd,

    In C1DataGrid, Loading all values in filter dropdown is by design, So you need to re-write your own filter dropdown containing values only from the filtered out rows. This can be done by setting the ItemsSource of MultiValueFilter for any column to only visible(or filtered out) values as follows :

    
    multiValueFilter.ItemsSource = GetColumnValues(e.Column);
    
    //Inside GetColumnValues(DataGridColumn)
    bool add = false;
    for (int r = 0; r < DataGrid.Rows.Count; r++)
    {
     if (DataGrid[r, index].Text.Equals(valueString) && DataGrid.Rows[r].Visibility.Equals(Visibility.Visible))
     {
      add = true;
      break;
     }
    }
    
    

    Please refer the attached sample(prj_DataGridAdvFilters.zip) for detailed implementation.

    Thanks & Regards,

    Basant

    prj_DataGridAdvFilters.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels