Docs
API
  • switcher

    Switcher field type

    Example

    
    items: [{
    ...
    },{
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true
    },{
    ...
    

    Properties

    events

    Array

    Set event handler to field.

    
    ...
    items: [{
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true
      events: [{
        change: function(){
          
        }
      }]
    },{
    ...
    

    id

    String

    If to set id, it will be possible to get link on widget over Fancy.getWidget.

    
    tbar: [{
      type: 'switcher',
      id: 'married',
      value: true
    },{
    ...
    }] 
    
    ...
    var switcher = Fancy.getWidget('married');
    
    switcher.set(true);
    

    label

    String

    Text of field.

    
    ...
    items: [{
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true
    },{
    ...
    

    labelAlign

    String

    Align of label.

    Values: right, left, top.

    
    ...
    items: [{
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true
      labelAlign: 'right'
    },{
    ...
    
    left

    name

    String

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

    
    ...
    items: [{
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true
      labelAlign: 'right'
    },{
    ...
    

    type

    String

    Type of field (value - switcher).

    
    {
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true
    }
    

    value

    Boolean

    Value of field.

    
    items: [{
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true
    ...
    

    Methods

    blur

    ()

    Blur field.

    
    field.blur();
    

    clear

    ()

    Clear value.

    
    tbar: [{
      type: 'switcher',
      id: 'married',
      value: true
    },{
    ...
    }] 
    
    ...
    var switcher = Fancy.getWidget('married');
    
    switcher.clear();
    

    disable

    ()

    Disable field.

    
    field.disable();
    

    enable

    ()

    Enable field.

    
    field.enable();
    

    focus

    ()

    Focus field.

    
    field.focus();
    

    get

    ():Boolean

    return value of field.

    
    tbar: [{
      type: 'switcher',
      id: 'married',
      value: true
    },{
    ...
    }] 
    
    ...
    var switcher = Fancy.getWidget('married');
    
    switcher.get();
    

    set

    (value:Boolean)

    set value of field.

    
    tbar: [{
      type: 'switcher',
      id: 'married',
      value: true
    },{
    ...
    }] 
    
    ...
    var switcher = Fancy.getWidget('married');
    
    switcher.set(true);
    

    setWidth

    (value: Number)

    Set new field width.

    
    field.setWidth(400);
    

    Events

    blur

    (field)

    Losing focus from field event.

    
    items: [{
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true,
      events: [{
        blur: function(){
          
        }
      }]
    ...
    

    change

    (field, value)

    Change field value event.

    
    items: [{
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true,
      events: [{
        change: function(){
          
        },
        scope: {}//not required
      }]
    ...
    

    focus

    (field)

    Focus field event.

    
    items: [{
      type: 'switcher',
      label: 'Active',
      name: 'active',
      value: true,
      events: [{
        focus: function(){
          
        }
      }]
    ...