ASP.NET Core MVC Controls | ComponentOne
Working with Controls / FlexGrid / Work with FlexGrid / Exclusive Value Search
In This Topic
    Exclusive Value Search
    In This Topic

    FlexGrid offers an exclusive value search feature which enables Excel-like behavior wherein searching excludes items from the filter. It provides ExclusiveValueSearch property in the ValueFilter and FlexGridFilter class, which sets a value that determines whether the filter should only include values selected by the FilterText property. This property is of type Boolean and is set to true, by default, allowing the search to exclude items from the filter. If set to false, searching only affects which items are displayed on the list and not which items are included in the filter.

    To include exclusive value search in FlexGrid, use the following code. In this example, we have created a model with Person type data that includes ID, Name, Country, First, Last and Sales properties.

    IndexController.cs

    C#
    Copy Code
    public static List<Person> Persons = SampleData.GetData().ToList();
            public ActionResult Index()
            {
                return View(Persons);
            }
    

    Index.cshtml

    cshtml
    Copy Code
    <h3>ExclusiveValue Search for All columns</h3>
    <c1-flex-grid id="flexGrid" auto-generate-columns="true" height="300px" >
        <c1-flex-grid-filter exclusive-value-search="true"></c1-flex-grid-filter>
        <c1-items-source source-collection="@Model"></c1-items-source>
    </c1-flex-grid>
    
    <h3>Exclusive Value Search for Name Column only.</h3>
    <c1-flex-grid id="grid" auto-generate-columns="true" height="300px" >
        <c1-flex-grid-filter >
            <c1-flex-grid-column-filter column="Name">
                <c1-flex-grid-value-filter exclusive-value-search="true"></c1-flex-grid-value-filter>
            </c1-flex-grid-column-filter>
        </c1-flex-grid-filter>
        <c1-items-source source-collection="@Model"></c1-items-source>
    </c1-flex-grid>