Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Example: TcxDataFilterCriteria.OnGetValueList, TcxFilterValueList.FindItemByValue, TcxFilterValueList.FindItemByKind, TcxFilterValueList.Add, TcxFilterValueList.Delete

  • 2 minutes to read

The following code lists the TcxDataFilterCriteria.OnGetValueList event handler, which customizes a list of values for a filter condition. In the event handler, two elements are deleted from the list for the DBTableView1EmpNo column. The first element is of the fviValue type and represents the value 2. The second element is of the fviCustom type. Also a new user-defined item is inserted into the value list for the DBTableView1SaleDate column.

procedure TForm1.DBTableView1DataControllerFilterGetValueList(
  Sender: TcxFilterCriteria; AItemIndex: Integer;
  AValueList: TcxDataFilterValueList);
var
  AIndex: Integer;
begin
//change the value list for the DBTableView1EmpNo column
  if AItemIndex = DBTableView1EmpNo.Index then
  begin
    //delete item 2 from the value list
    AIndex := AValueList.FindItemByValue(2);
    if AIndex <> -1 then
      AValueList.Delete(AIndex);
    //delete item of the fviCustom kind from the value list
    AIndex := AValueList.FindItemByKind(fviCustom);
    if AIndex <> -1 then
      AValueList.Delete(AIndex);
  end;
  //add user-defined item to the value list for the 
  //DBTableView1SaleDate column
  if AItemIndex = DBTableView1SaleDate.Index then
    AValueList.Add(fviUser, '', 'Filter TODAY', True);
end;
See Also