定制 wdmg/yii2-datepicker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wdmg/yii2-datepicker

最新稳定版本:1.1.0

Composer 安装命令:

composer require wdmg/yii2-datepicker

包简介

Bootstrap3 DatePicker Widget for Yii2

README 文档

README

Progress Github all releases GitHub version Progress GitHub license

Yii2 DatePicker

Bootstrap3 DatePicker Widget for Yii2

Requirements

  • PHP 5.6 or higher
  • Yii2 v.2.0.33 and newest
  • Yii2 Bootstrap
  • Bootstrap DatePicker v.1.1.0 and newest.

Installation

To install the widget, run the following command in the console:

$ composer require "wdmg/yii2-datepicker"

Usage

Example of standalone widget:

<?php

use wdmg\widgets\DatePicker;
...

echo DatePicker::widget([
    'model' => $model,
    'attribute' => 'datetime',
    'options' => [
       'class' => 'form-control'
    ],
    'pluginOptions' => [
        'className' => '.datepicker',
        'input' => '.form-control',
        'toggle' => '.input-group-btn > button',
    ]
    ...
]);

?>

Example of use with ActiveForm:

<?php

use wdmg\widgets\DatePicker;
...

$form = ActiveForm::begin();
...
echo $form->field($model, 'datetime')->widget(DatePicker::class, [
    'options' => [
        'class' => 'form-control'
    ],
    'pluginOptions' => [
        'className' => '.datepicker',
        'input' => '.form-control',
        'toggle' => '.input-group-btn > button',
    ]
    ...
]);
...
ActiveForm::end();

?>

Options

DatePicker extends InputWidget so you can use any options available for this widget. In addition, you can use these custom options if necessary:

Name Type Default Description
options array ['class' => 'form-control'] Standard options for the input widget.
pluginOptions array ['className' => '.datepicker', 'input' => '.form-control', 'toggle' => '.input-group-btn > button'] Plugin DatePicker options passed to js. Read more here (https://github.com/wdmg/bootstrap-datepicker).
template string {input}{addon} Widget output template.
addon string null Addon template addon. Use this option if you will not use the options listed below.
addonTag string span Addon input tag.
addonString string empty Addon content. Usually absent if you are using glypicon or fontawesome.
addonOptions array ['class' => 'glyphicon glyphicon-calendar', 'aria-hidden' => 'true'] Options tag addon input widget.
addonContainerTag string span Addon container tag.
addonContainerOptions array ['class' => 'input-group-btn'] Options of the container addon input widget.
addonButtonTag string button Tag who will display a DatePicker widget for input.
addonButtonOptions array ['class' => 'btn btn-default', 'type' => 'button'] Options of tag who will display a DatePicker widget for input.

Status and version

  • v.1.1.0 - Update copyrights and dependencies
  • v.1.0.8 - Fixed widget ID and init after Pjax reloading

统计信息

  • 总下载量: 942
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固