2amigos / yii2-date-picker-widget Goto Github PK
View Code? Open in Web Editor NEWBootstrap DatePicker Widget for Yii2
Home Page: https://2amigos.us
License: Other
Bootstrap DatePicker Widget for Yii2
Home Page: https://2amigos.us
License: Other
How to use this - http://bootstrap-datepicker.readthedocs.org/en/v1.6.0/options.html#format ?
Hi there,
Is there a way to identify which version of jquery are you using?
Or is there anyway that I could solve this issue?
I am using a templates which have the older version of jquery
'js/jquery-1.7.2.min.js', 'js/excanvas.min.js', 'js/chart.min.js', 'js/bootstrap.js', 'js/full-calendar/fullcalendar.min.js', 'js/base.js',
If I remove the jquery here, the error won't be showing and the datepicker will be working just fine.
However, I need those jquery in order to do other stuff so it can't be removed.
Or maybe noConflict() can help?
C:\wamp_new\www\yii2advance>php composer.phar require 2amigos/yii2-date-picker-w
idget:~1.0
You are running composer with xdebug enabled. This has a major impact on runtime
performance. See https://getcomposer.org/xdebug
The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0, this WIL
L break in the future and it should be fixed ASAP (require ^1.0 for example).
./composer.json has been updated
The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0, this WIL
L break in the future and it should be fixed ASAP (require ^1.0 for example).
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- 2amigos/yii2-date-picker-widget 1.0.x-dev requires bower-asset/bootstrap-d
atepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.5 requires bower-asset/bootstrap-datep
icker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.4 requires bower-asset/bootstrap-datep
icker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.3 requires bower-asset/bootstrap-datep
icker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.2 requires bower-asset/bootstrap-datep
icker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.1 requires bower-asset/bootstrap-datep
icker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.0 requires bower-asset/bootstrap-datep
icker 1.4.0 -> no matching package found.
- Installation request for 2amigos/yii2-date-picker-widget ~1.0 -> satisfiab
le by 2amigos/yii2-date-picker-widget[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5,
1.0.x-dev].
Potential causes:
Read https://getcomposer.org/doc/articles/troubleshooting.md for further commo
n problems.
Installation failed, reverting ./composer.json to its original content.
i have a problem that when my form is called in the modal it doesn't show me the datapicker i used in the form?? helps PLZ
It's necessary because private property can not use in classes which extends DateRangePicker.
For example, it may come in handy to redefine template without redefining of method DateRangePicker::run().
Everytime i save i get value 0000-00-00 00:00:00 im using mariadb for the database
I use widget in my _form.php
that is used both by create
and update
actions:
<?= $form->field($model, 'publication_date')->widget(
DatePicker::className(), [
'language' => 'ru',
'clientOptions' => [
'autoclose' => true,
'format' => 'dd.mm.yyyy',
'todayBtn' => true,
'pickerPosition' => 'top-left'
]
]);?>
When I select desired date in create
view, everything is fine:
But when I go to 'update' view I see that required field is rendered like this:
So, no format
is respected during rendering the field.
Any ways to fix?
Hi, recently I using this plugin and I found that if the date is 0000-00-00 it cannot be search. how i can avoid this problem?
The data will 0000-00-00 and I know is bad habit for database but I really need this
hello guys
I'm using this extension in a modal form, the modal form loaded from ajax. The response from the ajax request is un render partial the php view declare the active form
Thanks
DatePickerAsset.php defines css and js properties in the init function. Is there any reason for this?
When compressing and minifying those files with yii asset assets.php config/assets-prod.php (http://www.yiiframework.com/doc-2.0/guide-structure-assets.html) the widget still tries to publish them and gets an 404 error.
The following code results in the calendar always being displayed, and not working. There is no JS error in console.
<?php
use dosamigos\datepicker\DatePicker;
use yii\jui\AutoComplete;
?>
<?php $form = ActiveForm::begin(['layout' => 'horizontal', 'enableClientValidation' => false]); ?>
<?= $form->field($model, 'due')->widget(DatePicker::className(), [
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd',
]
]) ?>
<?= $form->field($model, 'country')->widget(AutoComplete::classname(), [
'clientOptions' => [
'source' => ['USA', 'RUS'],
],
]) ?>
<?php ActiveForm::end(); ?>
Good morning a question, the extension supports the configuration global setting formatter or specify it in the widget.
I am trying to install this widget in mac machine. I went to my Yii2-advanced project folder in terminal and I ran this command
composer require 2amigos/yii2-date-picker-widget:~1.0
After that it gives me this error:-
Your requirements could not be resolved to an installable set of packages.
Problem 1
- 2amigos/yii2-date-picker-widget 1.0.5 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.4 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.3 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.2 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.1 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.0 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- Installation request for 2amigos/yii2-date-picker-widget ~1.0 -> satisfiable by 2amigos/yii2-date-picker-widget[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5].
Side Note:- I don't have bootstrap-datepicker in my composer.json file
Hi guys,
I am passing inline => true
and trying to read the value of the input as it changes. Since it is changed by jQuery('#$id').val(e.format());
there is no 'change' or similar event fired.
I had to hack around it like this:
$('.datepicker-wrapper').on('click', function(e) { // datepicker widget does .val which does not trigger events
if (!($(e.target).is('.day'))) { // passing '.day' as second arg to .on does not work either because the whole thing gets redrawn
return;
}
setTimeout(function() { // and timeout because click happens faster than the .val
doThingWithValue($('#datepicker-input').val());
}, 32);
});
I think the best solution (besides using ActiveForm, I know) would be to let me pass my own clientEvents['changeDate'] and skip this if I do pass it:
if ($this->inline) {
$this->clientEvents['changeDate'] = "function (e){ jQuery('#$id').val(e.format());}";
}
Let me know if you want a pull request.
Mike
I need to set a pickupDate and pickupDateMax, the maximum date cannot be earlier than the initial date, i disabled the maxDate and should be set until pickupDate has some value, any ideas how to accomplish that?
This are my fields
<?=
$form->field($shipment, 'pickupDate')->widget(
DatePicker::className(), [
'clientOptions' => [
'autoclose' => true,
'todayHighlight' => true,
'language' => 'es',
'startDate' => '0d',
'format' => 'dd-M-yyyy'
]
]);
?>
<?=
$form->field($shipment, 'pickupDateMax')->widget(
DatePicker::className(), [
'clientOptions' => [
'autoclose' => true,
'todayHighlight' => true,
'language' => 'es',
'startDate' => '0d',
'format' => 'dd-M-yyyy'
],
'options' => [
'disabled' => true
]
]);
?>
Rename datepicker.css
to bootstrap-datepicker.css
for bootstrap-datepicker:1.4.0
, please.
I recently discovered that using the plug-in bootstrap drop-down menu can't be used. What should I do
When I click on the form field nothing happens. I can see the changes to the field, but doesn't work. Not sure if I missed something but I followed the installation without any issues.
<?php $form = ActiveForm::begin(); ?>
<?=$form->field($model, 'class_name')->dropDownList(
ArrayHelper::map(ClassTitles::find()->all(), 'class_name','class_name'), ['prompt'=>'Select a Class'])?>
<?= $form->field($model, 'price')->textInput() ?>
<?= $form->field($model, 'weeks')->textInput() ?>
<?= $form->field($model, 'starting_date')->widget(
DatePicker::className(), [
// inline too, not bad
'inline' => true,
// modify template for custom rendering
'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>',
'clientOptions' => [
'autoclose' => true,
'format' => 'dd-M-yyyy'
]
]);?>
<?= $form->field($model, 'ending_date')->textInput() ?>
<?= $form->field($model, 'time')->textInput() ?>
<?= $form->field($model, 'duration')->textInput() ?>
<?= $form->field($model, 'scheduled_on')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
the missing file: 'js/bootstrap-datepicker.js'. how to get it?
using daterangepicker in gridview documentation not given
1.view
2.model
3.controller.
Hi,
I am trying to install your plugin, and I am getting errors in composer.
I installed it once before, and it was fine.
I used the datepicker to display date of birth with model rules and controller validate(), unfortunately validation does not work.
VIEW
<?= DatePicker::widget([
'model' => $model,
'form' => $form,
'attribute' => 'dob',
'template' => '{addon}{input}',
'clientOptions' => [
'format' => 'L',
'autoclose' => true,
'format' => 'yyyy-mm-dd',
'endDate'=> '1970-12-31',
]
]);?>
MODEL RULE
[['dob'], 'required'],
[['dob'], 'date'],
CONTROLLER
if ($model->load(Yii::$app->request->post())&& $model->validate())
{
// save record.
}
Hello.
If i display same form multiple times at one page, DatePickerRange dosn`t appear more than 1 time (at first element).
Sample:
$form = ActiveForm::begin();
echo $form->field($model, 'date_attended_from')->widget(DateRangePicker::className(), [
'attributeTo' => 'date_attended_to',
'form' => $form,
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd'
]
]);
ActiveForm::end();
$form = ActiveForm::begin();
echo $form->field($model, 'date_attended_from')->widget(DateRangePicker::className(), [
'attributeTo' => 'date_attended_to',
'form' => $form,
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd'
]
]);
ActiveForm::end();
I think problem in duplicate id attribute. What can i do to fix that?
When using multidate and multidateSeparator in inline mode I notice only the last date selected is being updated in the input tag.
<?= DatePicker::widget([
'inline' => true,
'name' => 'test',
'template' => '<div class="well well-sm"
style="background-color: #fff; width:250px">{input}</div>',
'clientOptions' => [
'format' => "yyyy-mm-dd",
'weekStart' => 1,
'startDate' => "today+1",
'daysOfWeekDisabled' => "0",
'multidate' => true,
'multidateSeparator' => ";",
]
]);?>
For example if I select 2 dates :
The input tag value only contains 1 date ( last one selected ).
The file or directory to be published does not exist: vendor/bower/bootstrap-datepicker/dist
The depends must be a typo, daterange has nothing to do with the Language assets, should I create a PR to fix this?
https://github.com/2amigos/yii2-date-picker-widget/blob/master/src/DatePickerLanguageAsset.php#L24
I see you've changed the way you include js files in the bundle. Now you set js in the init function which makes it impossible to override it in assetManager. Can you fix this? Thanks.
Hey I have tried using daterange but it appearance shake when user interact with the attributeTo field. It break and give bad experience to user
The datapicker widget shows up, but clicking got no response, the value does not change at all.
Besides, language not working.
<?= $form->field($model, 'birth_date')->widget(
DatePicker::className(), [
// inline too, not bad
'inline' => true,
// 'language' => Yii::$app->language,
// modify template for custom rendering
'template' => '<div class="well well-sm" style="background-color: #fff; width:150px">{input}</div>',
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-MM-dd'
]
]);?>
All date should be yyyy-M-dd format, but when I change the date, I got yyyy年mm月dd日,it it not correct.
I posted this here.
smalot/bootstrap-datetimepicker#569
When you use the widget to pick only a time, the date header on the popup calendar is wrong.
is there anyway to set this date header for the popup calendar?
Described here uxsolutions/bootstrap-datepicker#978
How to set endDate to today?
I tried to install it by compsor and ran command.
Following errors I got and my php version is PHP 7.1.6.
The "https://bower.herokuapp.com/packages/jquery" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
https://bower.herokuapp.com/packages could not be fully loaded, package information was loaded from tYour requirements could not be resolved to an installable set of packages.
Problem 1
- 2amigos/yii2-date-picker-widget 1.0.7 requires bower-asset/bootstrap-datepicker 1.7.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.6 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.5 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.4 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.3 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.2 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.1 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- 2amigos/yii2-date-picker-widget 1.0.0 requires bower-asset/bootstrap-datepicker 1.4.0 -> no matching package found.
- Installation request for 2amigos/yii2-date-picker-widget ~1.0 -> satisfiable by 2amigos/yii2-date-picker-widget[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7].
Potential causes:
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
Installation failed, reverting ./composer.json to its original content.
code
$form->field($model, 'premiere')->widget(
DatePicker::className(), [
// inline too, not bad
'inline' => true,
'language' => 'ru',
// modify template for custom rendering
'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>',
'clientOptions' => [
'autoclose' => true,
'format' => 'dd.mm.yyyy'
]
]);
result
I don't know if should post this here or on dynamic form but I am posting anyway
I implemented it like this, the datepicker popup appears only for the first Item and not for the other dynamic items
<div class="panel-body">
<?php DynamicFormWidget::begin([
'widgetContainer' => 'dynamicform_wrapper', // required: only alphanumeric characters plus "_" [A-Za-z0-9_]
'widgetBody' => '.container-items', // required: css class selector
'widgetItem' => '.item', // required: css class
'limit' => 4, // the maximum times, an element can be cloned (default 999)
'min' => 1, // 0 or 1 (default 1)
'insertButton' => '.add-item', // css class
'deleteButton' => '.remove-item', // css class
'model' => $WorkExperiencesModels[0],
'formId' => 'dynamic-form',
'formFields' => [
'Title',
'Description',
'FKWorkSectorID',
'FKCountryID',
'FKCityID',
'StartDate',
'EndDate',
],
]); ?>
<div class="container-items"><!-- widgetContainer -->
<?php foreach ($WorkExperiencesModels as $i => $WorkExperiencesModel): ?>
<div class="item panel panel-default"><!-- widgetBody -->
<div class="panel-heading">
<h3 class="panel-title pull-left">خبرات العمل</h3>
<div class="pull-right">
<button type="button" class="add-item btn btn-success btn-xs"><i class="glyphicon glyphicon-plus"></i></button>
<button type="button" class="remove-item btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button>
</div>
<div class="clearfix"></div>
</div>
<div class="panel-body">
<?php
// necessary for update action.
if (! $WorkExperiencesModel->isNewRecord) {
echo Html::activeHiddenInput($WorkExperiencesModel, "[{$i}]ID");
}
?>
<?= $form->field($WorkExperiencesModel, "[{$i}]Title")->textInput(['maxlength' => true]) ?>
<div class="row">
<div class="col-sm-6">
<?= $form->field($WorkExperiencesModel, "[{$i}]Description")->textarea(['maxlength' => true]) ?>
</div>
<div class="col-sm-6">
<?= $form->field($WorkExperiencesModel, "[{$i}]FKWorkSectorID")->dropDownList(
ArrayHelper::map(Worksector::find()->all(), 'ID', 'Name'), // Flat array ('id'=>'label')
['prompt'=>''] // options
) ?>
</div>
</div><!-- .row -->
<div class="row">
<div class="col-sm-4">
<?= $form->field($WorkExperiencesModel, "[{$i}]FKCountryID")->dropDownList(
ArrayHelper::map(Countries::find()->all(), 'ID', 'Name'), // Flat array ('id'=>'label')
['prompt'=>'select country', // options
'onchange'=>'
console.log("fired");
$.post("index.php?r=cities/list&id='.'"+$(this).val(),function(data){
$("[{$i}]select#workexperience-fkcityid").html(data);
});'
])
?>
</div>
<div class="col-sm-4">
<?= $form->field($WorkExperiencesModel, "[{$i}]FKCityID")->dropDownList(
ArrayHelper::map(Cities::find()->all(), 'ID', 'Name'), // Flat array ('id'=>'label')
['prompt'=>''] // options
)
?>
</div>
<div class="col-sm-4">
<?= $form->field($WorkExperiencesModel, "[{$i}]StartDate")->widget(
DatePicker::className(), [
// inline too, not bad
// 'inline' => true,
// modify template for custom rendering
'template' => '{addon}{input}',
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd',
'startView'=>'year'
]
]);?>
</div>
<div class="col-sm-4">
<?= $form->field($WorkExperiencesModel, "[{$i}]EndDate")->widget(
DatePicker::className(), [
// inline too, not bad
// 'inline' => true,
// modify template for custom rendering
'template' => '{addon}{input}',
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd',
'startView'=>'year'
]
]);?>
</div>
</div><!-- .row -->
</div>
</div>
<?php endforeach; ?>
</div>
<?php DynamicFormWidget::end(); ?>
</div>
</div>
How I can use it with Yii::$app->language? If en_EN, ru_RU...
this is my model :
<?php
namespace common\models;
use Yii;
use yii\validators;
/**
* This is the model class for table "Eventi".
*
* @property integer $idEventi
* @property string $nomeEvento
* @property timestamp $datains
* @property date $dataInizio
* @property date $dataFine
* @property date $dataPrevista
* @property string $numPartecipanti
* @property string $insegnante
* @property string $svolgimento
*/
class Eventi extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
/*
public $dataInizio;
public $dataPrevista;
public $dataFine;
*/
public static function tableName()
{
return 'Eventi';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[[ 'nomeEvento', 'svolgimento'], 'required'],
[['svolgimento'], 'string'],
[['nomeEvento', 'numPartecipanti', 'insegnante'], 'string', 'max' => 45],
//[['dataInizio', 'dataFine', 'dataPrevista'],'controlloDate','skipOnEmpty' => false, 'skipOnError' => false]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'idEventi' => 'Id Eventi',
'nomeEvento' => 'Nome Evento',
'dataInizio' => 'Data Inizio',
'dataFine' => 'Data Fine',
'dataPrevista' => 'Data Prevista',
'numPartecipanti' => 'Num Partecipanti',
'insegnante' => 'Insegnante',
'svolgimento' => 'Svolgimento',
];
}
public function controlloDate($attribute,$params){
if (isset($this->dataPrevista)and !isset($this->dataInizio) and !isset($this->dataFine)){
return true;
}
else {
$this->addError($attribute, 'Se riempi il campo data prevista non puoi riempire i campi data fine e data inizio!');
return false;
}
}
}
and this is my view
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use dosamigos\datepicker\DatePicker;
/* @var $this yii\web\View */
/* @var $model common\models\Eventi */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="eventi-form">
<?php $form = ActiveForm::begin(); ?>
<?//S= $form->field($model, 'idEventi')->textInput() ?>
<?= $form->field($model, 'nomeEvento')->textInput(['maxlength' => 45]) ?>
<div class="col-lg-4">
<?= $form->field($model, 'dataInizio')->widget(
DatePicker::className(), [
// inline too, not bad
'inline' => false,
//lingua
'language' => 'it',
// modify template for custom rendering
//'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>',
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-MM-dd'
]
]);?>
</div>
<div class="col-lg-4">
<?= $form->field($model, 'dataFine')->widget(
DatePicker::className(), [
// inline too, not bad
'inline' => false,
//lingua
'language' => 'it',
// modify template for custom rendering
//'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>',
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-MM-dd'
]
]);?>
</div>
<div class="col-lg-4">
<?= $form->field($model, 'dataPrevista')->widget(
DatePicker::className(), [
// inline too, not bad
'inline' => false,
//lingua
'language' => 'it',
// modify template for custom rendering
//'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>',
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-MM-dd'
]
]);?>
</div>
<?php
$t=time();
$data=date("Y-m-d-G-i-s",$t);
?>
<?= Html::activeHiddenInput($model,'data_ins',array('value'=>$data)) ?>
<?= $form->field($model, 'numPartecipanti')->textInput(['maxlength' => 45]) ?>
<?= $form->field($model, 'insegnante')->textInput(['maxlength' => 45]) ?>
<?= $form->field($model, 'svolgimento')->textarea(['rows' => 6]) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
but when i submit in the view i havent not value in thedate 3 fields
Hello,
I'm using your datetime picker, but I'm trying to change the width of the field (because it's too big) and unfortunatelly I'm not suceeding.
Can you help me?
Thank you.
Hello.
I want to disable error hint on both inputs of DateRangePicker. But I can't see the way to change input templates through options.
Hello it looks like it doesn't accept tabindex in textInput:
<?= $form->field($profile, 'birthday')->textInput([ 'tabindex' => 3])->label('Birth date')->widget(DatePicker::className(), [
'inline' => false,
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd',
'startDate' => '1900-01-01',
'startView' => 2,
'value' => 'YYYY-MM-DD',
]
]); ?>
Is this intention (to be handled by JS) or just an omitted feature?
Thanks.
Im using the date picker widget inside the gridview to filter. But i need a datepicker that shows only month and year.
I have tried many options like -
'changeMonth'=>true,
'changeYear'=>true,
'changeDay'=>false,
but not working.
This is my code:
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
'name',
'otp_num',
[
'attribute'=> 'otp_created_date',
'value'=>'otp_created_date',
'format'=>'raw',
'filter'=>DatePicker::widget([
'model' =>$searchModel,
'attribute' => 'otp_created_date',
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-m-d',
]
]),
],
],
'options' => [
'changeMonth'=>true,
'changeYear'=>true,
'changeDay'=>false,
]
]);
?>
In form update date does not set default in calendar view.
Can't figure out how clear button works. Using simple configuration of widget in GridView filter:
<?php Pjax::begin(); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'username',
'email:email',
'created_at:datetime',
[
'attribute' => 'last_login',
'format' => 'datetime',
'filter' => DatePicker::widget([
'model' => $searchModel,
'attribute' => 'last_login',
'template' => '{addon}{input}',
'clientOptions' => [
'autoclose' => true,
'format' => 'yyyy-mm-dd',
'clearBtn' => true,
],
])
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
<?php Pjax::end(); ?>
Pushing clear does'nt reload GridView. Inputs val() clears, but actual attribute value - not. It seems that none of change event is firing also. Am I miss something simple? In other parts widget works just great.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.