Skip to content

选项

Note

所有的方法可通过 data 的属性访问,例如:
$('#datetimepicker').data("DateTimePicker").OPTION()

options()

返回组件当前的选项(object 形式的)。注意这不会改变组件当前的配置。用 options(options) 可以设置多个选项或者其他方法单独的设置选项。

options([options])

传入具有选项 key:value 属性的对象变量并配置组件。用这个方法更新组件的多个选项。

date

format

dayViewHeaderFormat

extraFormats

stepping

min/maxDate

Default: false
Accepts: date, moment, string
给 minDate 和 maxDate 赋值,代表限制了可选时间的范围。

示例

useCurrent

Default: trueshow 的时候,将会设置为当前的时间

collapse

locale

defaultDate

en/disabledDates

icons

useStrict

sideBySide

daysOfWeekDisabled

calendarWeeks

viewMode

toolbarPlacement

showTodayButton

showClear

showClose

widgetPositioning

Default: {
            horizontal: 'auto'
            vertical: 'auto'
         }
Accepts: object with the all or one of the parameters above
         horizontal: 'auto', 'left', 'right'
         vertical: 'auto', 'top', 'bottom'
widgetPositioning()

返回当前设置的 options.widgetPositioning 对象,它包含了两个 key,是 horizontalvertical

widgetPositioning(positioningObject)

传入一个对象为参数,参数包含两个 key,分别是 verticalhorizontalvertical 的值可为 'auto', 'top', 'bottom'horizontal 的值可为 'auto', 'left', 'right',可以定义下拉列表相对于 input 元素的位置。

'auto' 对于 verticalhorizontal 都是默认的值,它尝试自动将下拉列表放在一个对用户可见的位置。一般来说,你不需要复写这些属性,除非你有特殊的布局需求。

widgetParent

Default: null
Accepts: string or jQuery object

keepOpen

inline

keepInvalid

keyBinds

debug

ignoreReadonly

disabledTimeIntervals

allowInputToggle

focusOnShow

en/disabledHours

viewDate

parseInputDate

tooltips

timeZone