2017 © Pedro Peláez
 

library input-switch

bootstrap switch for Yii2

image

kak/input-switch

bootstrap switch for Yii2

  • Monday, December 14, 2015
  • by sanchezzzhak
  • Repository
  • 1 Watchers
  • 0 Stars
  • 115 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 10 % Grown

The README.md

kak-input-switch

bootstrap-switch widget for Yii2, (*1)

Documentation

  • @docs options http://www.bootstrap-switch.org/options.html
  • @docs methods http://www.bootstrap-switch.org/methods.html
  • @docs events http://www.bootstrap-switch.org/events.html

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist kak/input-switch "dev-master"

or add, (*4)

"kak/input-switch": "dev-master"

to the require section of your composer.json file., (*5)

Usage

ActiveForm, (*6)

echo $form->field($model, 'list')->widget('\kak\widgets\InputSwitch\InputSwitch', [
    'options' => [
        'data-id'   => $model->id,
        'data-size' => 'small'
    ],
]) ?>

Native, (*7)

echo  \kak\widgets\InputSwitch\InputSwitch::widget([
    'name' => 'OperatorSwitch[' . $model->id . ']',
    'value' => $model->status == true,
    'options' => [
        'data-id'   => $model->id,
        'data-size' => 'small'
    ]
]);

Use Events, (*8)

$js =<<<JS
   $('.InputSwitch').on('switchChange.bootstrapSwitch', function(event, state) {
      $.post('/finance/credit-operator-switch',{status: state, id: $(this).data('id') })
    });
JS;
$this->registerJs($js)
?>

The Versions

14/12 2015

dev-master

9999999-dev

bootstrap switch for Yii2

  Sources   Download

MIT

The Requires

 

by Tutik Alexsandr

yii2 bootstrap-switch