ASP.NET MVC コントロールヘルプ
排他値の検索
コントロールの使用 > FlexGrid > FlexGridの使用 > 排他値の検索

FlexGrid offers an exclusive value search feature which enables Excel-like behavior wherein searching excludes items from the filter. It provides ExclusiveValueSearch property in ValueFilter 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

Example Title
コードのコピー
public static List<Person> Persons = SampleData.GetData().ToList();
        public ActionResult Index()
        {
            return View(Persons);
        }

Index.cshtml

Example Title
コードのコピー
@(Html.C1().FlexGrid<Person>().Id("flexGrid")
      .Filterable(f => f.DefaultFilterType(FilterType.Both)
           .ColumnFilters(cfsb =>
            {
                  cfsb.Add(cfb => cfb.Column("First").FilterType(FilterType.Value).ValueFilter(vfb =>
                  {
                       vfb.ExclusiveValueSearch(true);
                   }));
             })
    )
    .Bind(m => m.Bind(Model)
)