API
Component

DateFilter ($UI/system/components/justep/dateFilter/dateFilter)

使用范围:UI2

Contents

component DateFilter ($UI/system/components/justep/dateFilter/dateFilter) extends ViewComponent

日期过滤组件

	
		DateFilter组件通过简单的属性设置就可以给数据增加日期过滤的能力,关键属性有:
			filterData: 过滤数据
			filterMode: 过滤模式 “单日期过滤” “日期范围过滤”
			dateCol、beginDateCol、endDateCol: 过滤日期字段
	

Constructor Top

  DateFilter ()
  DateFilter ( options)

Properties Top

date customBeginDate

自定义开始日期

date customEndDate

自定义结束日期

observable selectedLabel

选中数据的显示值,可以通过set和get方法存取。

observable selectedValue

选中数据,可以通过set和get方法存取。

Attributes Top

boolean autoRefresh

是否自动刷新 - 默认是true,用户输入后不仅设置数据的过滤条件,同时自动刷新数据。

string beginDateCol

日期范围过滤模式下的开始日期字段

string dateCol

单日期过滤模式下的日期字段

string defaultValue

默认选项,当选择数据为空时,用默认选项过滤。

string endDateCol

日期范围过滤模式下的截止日期字段

string filterData

过滤数据,必须是bizData

string filterMode

过滤模式,singleDate:单日期过滤,dateRange:日期范围过滤

string options

可选项,枚举可列出的日期过滤方式,以逗号分隔,例如:今天,明天,自定义。

string xid

组件标识

Methods Top

void clear ()
void filter (strign dateType, date beginDate, date endDate)
object getDateRange ()
string getFilterFlag ()
string getFilterStr ()

Operations Top

clearFilter ()

Events Top

void onFilter (ViewEvent event)

Constructor details Top

public DateFilter ()

日期过滤组件

	
		DateFilter组件通过简单的属性设置就可以给数据增加日期过滤的能力,关键属性有:
			filterData: 过滤数据
			filterMode: 过滤模式 “单日期过滤” “日期范围过滤”
			dateCol、beginDateCol、endDateCol: 过滤日期字段
	

public DateFilter ( options)

构造函数

Inherited from ViewComponent

	
		参数options格式类似{parent:xx, config:{}},parent是组件的父节点,允许为空或不指定,config是组件的参数选项
	 

Parameters

options

参数选项

Properties Detail Top

public date customBeginDate

自定义开始日期

public date customEndDate

自定义结束日期

public observable selectedLabel

选中数据的显示值,可以通过set和get方法存取。

public observable selectedValue

选中数据,可以通过set和get方法存取。

Attributes Detail Top

public boolean autoRefresh

是否自动刷新 - 默认是true,用户输入后不仅设置数据的过滤条件,同时自动刷新数据。

public string beginDateCol

日期范围过滤模式下的开始日期字段

public string dateCol

单日期过滤模式下的日期字段

public string defaultValue

默认选项,当选择数据为空时,用默认选项过滤。

public string endDateCol

日期范围过滤模式下的截止日期字段

public string filterData

过滤数据,必须是bizData

public string filterMode

过滤模式,singleDate:单日期过滤,dateRange:日期范围过滤

public string options

可选项,枚举可列出的日期过滤方式,以逗号分隔,例如:今天,明天,自定义。

public string xid

组件标识

Methods Detail Top

public void clear ()

清除过滤条件

Return Value

void

public void filter (strign dateType, date beginDate, date endDate)

设置数据的过滤条件,如果“自动刷新”则刷新数据;开发者可以通过onFilter事件接管。 可以通过dateType、beginDate和endDate三个参数,指定过滤范围: 上周 : this.comp("dateFilter1").filter("lastWeek") 2015-02-02 - 2015-03-18 : this.comp("dateFilter1").filter("custom", new Date(2015, 1, 2), new Date(2015, 2, 18)) (注意JS中month从0开始)

Parameters

strign dateType

过滤日期类型:all、today、yesterday、thisWeek、lastWeek、thisMonth、lastMonth、thisYear、lastYear、custom

date beginDate

自定义开始日期

date endDate

自定义结束日期

Return Value

void

public object getDateRange ()

获取过滤日期范围
返回结构如下:

{ "begin" : 开始日期 "end" : 截止日期 }

Return Value

object

public string getFilterFlag ()

获取过滤条件标识

Return Value

string

public string getFilterStr ()

获取过滤条件字符串

Return Value

string

Operations Detail Top

public clearFilter ()

清除过滤条件

Events Detail Top

public void onFilter (ViewEvent event)

过滤事件

Parameters

ViewEvent event


结构如下:

{ "source" : 组件的js对象 "bindingContext" : 组件绑定的上下文,包含$model、$object等具体请参考bindingContext说明 }

Return Value

void