C1.Xamarin.Forms.Grid FlexGrid Xamarin.Forms filter with CheckBox

Posted by: nort.skype on 29 March 2021, 12:25 am EST

  • Posted 29 March 2021, 12:25 am EST

    How i can filtering FlexGrid with CheckBox?
    Like this: https://www.grapecity.com/componentone/docs/xamarin/online-forms/filter-row.html
    But using only CheckBox Multi-Select, perhaps with Picker.
    Filter must be on each column.
  • Replied 30 March 2021, 1:28 am EST

    Hi Andrew

    FlexGrid supports filtering using the FilterExpression which is supported by ISupportFiltering, For reference please refer to the Filter sample of the attached FlexGrid101 sample.

      You can observe the Filter icon on the toolbar of the filter sample.
      Provide the Filter value of the particular column with appropriate FilterOperation.


    Please let me know if you need any other help.

    Thanks
    FlexGrid101.zip
  • Replied 31 March 2021, 4:11 pm EST

    Hello, abhishek.tayal =)
    Thanks, the example works great. I will implement filtering using CheckBox.
    Your library has something similar to this, for Xamarin.Forms:
    - https://help.syncfusion.com/xamarin/combobox/multiple-selection
    - https://github.com/TBertuzzi/Xamarin.Forms.MultiSelectListView
    I need DropDown menu of CheckBox with multi-selection.
  • Replied 1 April 2021, 6:19 pm EST

    How can I filter a column by multiple values?
    For example, I have a list of people and I need to filter the "Name" column by the following names: Gil, Ted, Ben. And I expect to see all three people.
  • Replied 4 April 2021, 10:42 pm EST

    Hi Andrew

    Filtering in FlexGrid is handled through ISupportFiltering, this uses the FilterAsync method to filter the Flexgrid as per the filterexpression.

    For reference please have a look at the "Filter" sample of the attached FlexGrid101 sample.

    Click on the cell(FirstName column) of the FlexGrid to filter with firstname(can be multiple), then click on the filter button in the toolbar. It will filter the Flexgrid as per the Firstname clicked by the user before the Filter button clicked.

    You can also remove the filter by clicking on the Remove filter and can add a new filter after that.

    For reference please have a look at the attached video.

    Please let me know if you need any other help.

    Thanks
    FlexGrid101.zip
    FlexGrid_Filter.zip
  • Replied 6 April 2021, 5:19 pm EST

    Thanks!
    I am doing filtering as in the example, but I cannot figure out how to apply filtering to the FlexGrid used.
    Code:
    ISupportFiltering supportFiltering;
    List<FilterExpression> listFilterExpressions;

    supportFiltering = flexGrid.DataCollection as ISupportFiltering;
    listFilterExpressions = new List<FilterExpression>();

    listFilterExpressions.Add(new FilterOperationExpression(flexGrid.Columns[2].Binding, FilterOperation.IsOneOf, objectArray));
    listFilterExpressions.Add(new FilterOperationExpression("NameOfColumn", FilterOperation.IsOneOf, objectArray));

    await supportFiltering.FilterAsync(FilterExpression.Combine(FilterCombination.And, listFilterExpressions.ToArray()));


    How can I apply the created filtering to the used one FlexGrid?
    It is possible to do this without using: INotifyPropertyChanged, IEditableObject?
  • Replied 7 April 2021, 12:14 am EST

    Hi David

    =>How can I apply the created filtering to the used one FlexGrid?

    does this mean to apply a filter on the flexgrid whose data is edited?

    I updated the cells of firstname column of the few rows and add a filter for the firstname as per the new value, this applies filtering perfectly on the updated grid data.
    For reference please have a look at the attached video.

    Please let me know if you need any other help.

    ThanksFiltering.zip
  • Replied 7 April 2021, 11:25 pm EST

    You did not quite understand me correctly.
    The example applies a filter to an instance of the "ISupportFiltering" interface. The instance is named "filtering". This line:
    await filtering.FilterAsync(FilterExpression.Combine(FilterCombination.And, filters.ToArray()));

    The main table is called "grid" and is an instance of the FlexGrid class.
    How the created filter, which was applied to the instance of the "ISupportFiltering" interface, is applied to the main table of the FlexGrid class?

    P.S. I interest the code, not the visual part.
  • Marked as Answer

    Replied 11 April 2021, 3:36 pm EST

    Hi David

    Filtering in FlexGrid is supported through ISupportFiltering.

    await filtering.FilterAsync(FilterExpression.Combine(FilterCombination.And, filters.ToArray()));


    in the above code filtering object is the reference of the DataCollection of the FlexGrid

    For details please refer to the below documentation
    https://www.grapecity.com/componentone/docs/services/online-datacollection/filtering.html

    Please let me know if you need any other help.

    Thanks
Need extra support?

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

Learn More

Forum Channels