dashboard-js-devexpress-dot-dashboard-dot-model-f645fdab.md
A Date Filter dashboard item that allows end users to filter other dashboard items by date-time values.
export class DateFilterItem extends DataDashboardItem
The Date Filter allows end users to apply filtering by date to other dashboard items. It displays a set of intervals that allow you to filter out values. You can use Date Filter as a compact counterpart of the Range Filter dashboard item.
The following example creates the Date Filter item, binds it to data, and adds it to the existing dashboard.
Create a dimension and use the dataMember property to bind it to the existing data source’s column. After, use the created dimension in the dashboard item to bind the Date Filter to data.
Create a DateTimePeriod instance and add it to the DateFilterItem.dateTimePeriods collection to create quick filters.
After you add the created dashboard item to the Dashboard.items collection, call the Dashboard.rebuildLayout method to rebuild the dashboard layout and display changes.
// Use the line below for a modular approach:
// import * as Model from 'devexpress-dashboard/model'
// Use the line below for an approach with global namespaces:
// var Model = DevExpress.Dashboard.Model;
// ...
public createDateFilter() {
// Create a data item for the Date Filter item.
var dateFilterDate = new Model.Dimension();
dateFilterDate.dataMember("OrderDate");
dateFilterDate.dateTimeGroupInterval("DayMonthYear")
// Create the Date Filter and bind it to data.
var dateFilter = new Model.DateFilterItem();
dateFilter.name('Date Filter');
dateFilter.dataSource(sqlDataSource.componentName());
dateFilter.dataMember(sqlDataSource.queries()[0].name());
dateFilter.dimension(dateFilterDate);
// Create a custom period for quick filters.
var monthToDayPeriod = new Model.DateTimePeriod();
monthToDayPeriod.name("Month to Date");
monthToDayPeriod.start.flow.interval("Month").offset(0);
monthToDayPeriod.start.mode("Flow");
monthToDayPeriod.end.flow.interval("Day").offset(1);
monthToDayPeriod.end.mode("Flow");
dateFilter.dateTimePeriods.push(monthToDayPeriod);
control.dashboard().items.push(dateFilter);
// ...
control.dashboard().rebuildLayout();
}
SerializableModel TypedSerializableModel DashboardItem DataDashboardItem DateFilterItem
Initializes a new instance of the DateFilterItem class.
constructor(
dashboardItemJSON?: any,
serializer?: DevExpress.Analytics.Utils.ModelSerializer
)
| Name | Type | Description |
|---|---|---|
| dashboardItemJSON | any |
A JSON object used for dashboard deserialization. Do not pass this parameter directly.
| | serializer | ModelSerializer |
An object used for dashboard deserialization. Do not pass this parameter directly.
|
Specifies a layout of the elements inside the Date Filter.
arrangementMode: ko.Observable<DevExpress.Dashboard.Model.DateFilterArrangementMode>
| Type | Description |
|---|---|
| Observable<DateFilterArrangementMode> |
A DateFilterArrangementMode value that specifies how the DateFilter item organizes its elements.
|
Use the DateFilterItem.dateTimePeriods property to create quick filter elements.
currentSelectedDateTimePeriodName: ko.Observable<string>
| Type |
|---|
| Observable<string> |
Specifies the Date Picker’s location in the Date Filter.
datePickerLocation: ko.Observable<DevExpress.Dashboard.Model.DatePickerLocation>
| Type | Description |
|---|---|
| Observable<DatePickerLocation> |
A DatePickerLocation value that specifies the Date Picker’s location.
|
Gets a collection of date-time periods used as Quick Filters.
dateTimePeriods: ko.ObservableArray<DevExpress.Dashboard.Model.DateTimePeriod>
| Type | Description |
|---|---|
| ObservableArray<DateTimePeriod> |
A DateTimePeriod object that is a collection of date-time periods.
|
See Also
Predefined Ranges for the Range Filter in the Web Dashboard
Gets a name of the default date-time period used as Quick Filters.
defaultDateTimePeriodName: ko.Observable<string>
| Type | Description |
|---|---|
| Observable<string> |
A string that is a name of the default date-time period.
|
Use dateTimePeriods to get a collection of date-time periods used as Quick Filters.
Specifies a dimension that provide values for the Date Filter.
dimension: ko.Observable<DevExpress.Dashboard.Model.Dimension>
| Type | Description |
|---|---|
| Observable<Dimension> |
A Dimension object used to provide values for the filter element.
|
Specifies a string displayed in the Date Picker.
displayTextPattern: ko.Observable<string>
| Type | Description |
|---|---|
| Observable<string> |
A string displayed in the Date Picker.
|
A string can contain the {0} placeholder to display the range Start and the {1} placeholder to display the range End. If the DateFilterItem.filterType value is Between, the displayTextPattern value is “{0} - {1}”.
Specifies the Date Filter type.
filterType: ko.Observable<DevExpress.Dashboard.Model.DateFilterType>
| Type | Description |
|---|---|
| Observable<DateFilterType> |
A DateFilterType object that specifies the Date Filter type.
|
The DateTime range set in the Date Filter can be interpreted differently - to filter dates before a certain date, after a certain date, between two dates, or to filter a date equal to a certain date. The filterType property specifies the interpretation.
Provides access to interactivity options, such as Master Filtering and drill-down settings.
interactivityOptions: DevExpress.Dashboard.Model.FilterableDashboardItemInteractivityOptions
| Type | Description |
|---|---|
| FilterableDashboardItemInteractivityOptions |
A FilterableDashboardItemInteractivityOptions object that contains interactivity settings.
|