Showing posts with label Grid. Show all posts
Showing posts with label Grid. Show all posts

Monday, 27 January 2014

DevExpress Grid Modify Date Header Filter

In a DevExpress grid I needed to remove options from the filter that is available from the column header. Because the header related to the date column it put in a load of filter options that I did not require. I managed to do this by creating an OnGetFilterValues event:

MyGridView.Columns[MyGridView.GetColumnByFieldName('MY_DATE_FIELD').Index].OnGetFilterValues := cxGridGetFilterValues;

Then I put the following code in the procedure:

procedure MyFrm.cxGridGetFilterValues(Sender: TcxCustomGridTableItem; AValueList: TcxDataFilterValueList);

    procedure DeleteFilterEntry(AValue: Variant);
    begin
        AValueList.Delete(AValueList.FindItemByKind(fviSpecial,               AValue));
    end;
begin
      DeleteFilterEntry(foYesterday);
      DeleteFilterEntry(foToday);
      DeleteFilterEntry(foTomorrow);

      DeleteFilterEntry(foNext7Days);
      DeleteFilterEntry(foNext14Days);
      DeleteFilterEntry(foNext30Days);
end;

There are more filter options that could be removed, it just a matter of looking at the unit that contains the constants.

Thursday, 22 August 2013

DevExpress Quantumgrid Header Height

I have had a problem recently using a DevExpress Quantum Grid which has the column filters enabled and also the ability to drag and drop. I needed a way to get the header height so it would ignore the begindrag. The after trying a few things this is the best way I found to get the header height.

iHeaderHeight := GridView.ViewInfo.HeaderViewInfo.Bounds.Bottom -
      GridView.ViewInfo.HeaderViewInfo.Bounds.Top;