Docs
API
  • date

    Date field type

    Example

    
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday'
    

    Properties

    cls

    String

    The CSS class that will be added to field.
    It is used for custom styling field.

    
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday',
      cls: 'field-birthday'
    },{
    ...
    }]
    

    disabled

    Boolean

    Disable field.

    
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday',
      disabled: true
    },{
    ...
    //Enable field
    field.enable();
    
    //Disable field
    field.disable();
    

    editable

    Boolean

    It enables/disable editing field value.

    
    ...
    items: [{
      editable: false,
      type: 'date',
      label: 'Birthday',
      name: 'birthday'
    ...
    
    true

    events

    Array

    Set event handler to field.

    
    ...
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday'
      events: [{
        change: function(){
          
        }
      }]
    },{
    ...
    

    disabled

    Boolean

    Disable field.

    
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday',
      disabled: true
    },{
    ...
    

    format

    Mixed

    Formatting.

    
    {
      label: 'Birthday',
      name: 'birthday',
      value: item.birthday,
      format: {
        read: 'Y.m.d',
        write: 'Y.m.d',
        edit: 'd.m.Y'
      },
      type: 'date'
    }
    

    inputHeight

    Number

    Field input height. It influence only on fields with input element inside.

    
    {
      label: 'Birthday',
      name: 'birthday',
      value: item.birthday,
      format: {
        read: 'Y.m.d',
        write: 'Y.m.d',
        edit: 'd.m.Y'
      },
      type: 'date',
      inputHeight: 35
    }
    

    label

    String

    Text of field.

    
    ...
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday'
    },{
    ...
    

    labelAlign

    String

    Align of label.

    Values: right, left, top.

    
    ...
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday'
      labelAlign: 'right'
    },{
    ...
    
    left

    max

    Date

    The maximum allowed date value for this field.

    
    ...
    items: [{
      type: 'sale',
      label: 'Sale',
      name: 'sale',
      max: new Date() //today
    },{
    ...
    

    min

    Date

    The minimum allowed date value for this field.

    
    ...
    items: [{
      type: 'sale',
      label: 'Sale',
      name: 'sale',
      max: new Date(), //today
      min: new Date(2017, 1, 1)
    },{
    ...
    

    name

    String

    Name of field over which it is possible to get value of field.

    
    ...
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday'
    },{
    ...
    

    type

    String

    Type of field (value - date).

    
    {
      type: 'date',
      label: 'Birthday',
      name: 'birthday'
    }
    

    value

    Date

    Value of field.

    
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday',
      value: new Date()
    ...
    

    Methods

    blur

    ()

    Blur field.

    
    field.blur();
    

    clear

    ()

    Clear value.

    
    tbar: [{
      type: 'number',
      id: 'employee',
      value: 1
    },{
    ...
    }] 
    
    ...
    var numberField = Fancy.getWidget('employee');
    
    numberField.clear();
    

    disable

    ()

    Disable field.

    
    field.disable();
    

    enable

    ()

    Enable field.

    
    field.enable();
    

    focus

    ()

    Focus field.

    
    field.focus();
    

    get

    ():String

    return value of field.

    
    field.get();
    

    set

    (value: Date)

    Sets value of field.

    
    field.set(new Date(2017, 2, 17));
    

    setWidth

    (value: Number)

    Set new field width.

    
    field.setWidth(400);
    

    Events

    blur

    (field)

    Losing focus from field event.

    
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday',
      events: [{
        blur: function(){
          
        }
      }]
    ...
    

    change

    (field, value)

    Change field value event.

    
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday',
      events: [{
        change: function(){
          
        },
        scope: {}//not required
      }]
    ...
    

    focus

    (field)

    Focus field event.

    
    items: [{
      type: 'date',
      label: 'Birthday',
      name: 'birthday',
      events: [{
        focus: function(){
          
        }
      }]
    ...