Giter Site home page Giter Site logo

yii2-jui's People

Contributors

andersonamuller avatar bwoester avatar cebe avatar creocoder avatar crtlib avatar egorpromo avatar ext4yii avatar fdezmc avatar gevik avatar gonimar avatar kartik-v avatar klimov-paul avatar lancecoder avatar larryullman avatar lucianobaraglia avatar mohorev avatar nineinchnick avatar pmoust avatar qiangxue avatar ragazzo avatar resurtm avatar rinatio avatar samdark avatar schmunk42 avatar sensorario avatar slavcodev avatar softark avatar suralc avatar tarasio avatar tonydspaniard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-jui's Issues

FormatConverter::convertDatePhpToJui() method call does not match method signature

In yii\jui\DatePicker::run:

https://github.com/yiisoft/yii2-jui/blob/master/DatePicker.php#L142

...
if (strncmp($this->dateFormat, 'php:', 4) === 0) {
   $this->clientOptions['dateFormat'] = FormatConverter::convertDatePhpToJui(substr($this->dateFormat, 4), 'date', $language);
} else {
...

But in \yii\helpers\BaseFormatConverter::convertDatePhpToJui

https://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseFormatConverter.php#L460

...
     * @param string $pattern date format pattern in php date()-function format.
     * @return string The converted date format pattern.
     */
    public static function convertDatePhpToJui($pattern)
    {
...

DatePicker problem with php7.0-intl

What steps will reproduce the problem?

I works on multi language application arabic and english
the problem that when i want to edit a date while i am open the backend as arabic language the date shows as arabic numbers and if i save the form the data will saved as arabic numbers to my database.
Edit date form :

<?= $form->field($model, 'match_date')->widget(\yii\jui\DatePicker::classname(),[
      'language' => Yii::$app->language,
      'dateFormat' => 'yyyy-MM-dd',
      'options' => ['class' => 'form-control']
]) ?>

screen shot 2017-03-28 at 8 02 20 pm

On my frontend application i install php intl and yii2 formatter works good for me but the arabic date will show an error and the page failed to load because the arabic numbers
screen shot 2017-03-28 at 8 02 33 pm

I think DatePicker must always saved date as english

| Yii vesion | 2.0.6
| PHP version | 7
| Operating system | ubuntu

How to add "onClose" event to datepicker?

I want to bind two datepickers for choosing period. So, date of the first one should be lower than second one. I want to use datepicker's "onClose" option. But I can't find something looks like this in the manual of widget.
What the best way to add option "onClose" or maybe you know another method for choosing period with JQuery UI components?

$.fn.button.noConflict is not a function

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii vesion 2.0.11.2.
PHP version 5.5.9-1ubuntu4.21
Operating system ubuntu4.21

image

How to prevent selection of date after today?

That's what I have tried:

field($pessoa_has_infracao, 'data')->widget(DatePicker::classname(),[ 'name' => 'to_date', 'clientOptions' => [ 'dateFormat' => 'dd/MM/yyyy', 'maxDate' => '0', ], 'options' => [ 'maxDate' => '0', 'class' => 'round form-control', 'placeholder' => "Data" ], ])->label(false); ?>

Note that I put maxDate inside both clientOptions and options because I don't know where I should place it. Anyways, it didn't work.

How can I do it?

Ignored exception handling in DatePicker

File: https://github.com/yiisoft/yii2-jui/blob/8195a03e1a0bf64fe1df20b8993b6c7bad0e1b10/src/DatePicker.php
Issue: L177-182
If you configure the widget incorrectly by setting an invalid dateFormat value, the widget will behave as commented on L181: "// ignore exception and keep original value if it is not a valid date".

If you make an error in the widget configuration, you should be notified about that error, because it's a bug.

Current behavior catches the exception and then ignores it as if it was not a problem. There should only be a fallback to defaults when the dateFormat property was not included in the configuration array at all.

yii2-jui Dialog Misses close Icon

This issue has originally been reported by @mtangoo at yiisoft/yii2#5471.
Moved here by @klimov-paul.


The problem seems to be with Jquery and there is a workaround mentioned here
and here I quote it:

"The reason this is happening, is because you are calling bootstrap in, after you are calling jquery-ui in. Literally, swap the two so that instead of:

<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="/js/bootstrap.min.js"></script> 

it becomes

 <script src="js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>  

"

dateFormat: 'php:' do not work correct

With simple config

// config:
'formatter' => [
  'class' => 'yii\i18n\Formatter',
//  'dateFormat' => 'php:d-M-Y',
  'dateFormat' => 'dd.MM.yyyy',
],

// model rules():
['published_at', 'date', 'timestampAttribute' => 'published_at'],

// widget:
$form->field($model, 'published_at')->widget(DatePicker::className(), [
  'options' => ['class' => 'form-control'],
])

everything works ok, but if 'dateFormat' of formatter will be changed to, for example 'php:d-M-Y' datePicker widget starts handle different with DateValidator formatting, so posted value will never pass validation.

if alternately set up 'format' for model rule and same format as 'dataFormat' for DatePicker widget to avoid using global formatter values, anyways it will handle format 'php:d-M-Y' incorrectly. Client script looks like:

  $('#post-published_at').datepicker($.extend({}, $.datepicker.regional['ru'], {"dateFormat":"dd-M-yy"}));

and when form with existent data loads, then data shown (for russian locale) as "19-мая-2016" but when I changed date - it shown as "18-Май-2016". so it has different form of nouns for month and obviously format is not same.

I am not sure it is real bug, but looks like some date format won't be handled correctly as described.

Additional info

component version
Yii vesion 2.0.8
PHP version 7.0.4
Operating system Ubuntu xenial

`DatePicker` conflict.

When I use DatePicker on page, like as

<?= DatePicker::widget([
                    'model' => $context->model,
                    'attribute' => 'date',
                    'options' => [
                        'required' => 'true',
                        'placeholder' => 'Select date',
                        'class' => 'form-control',
                    ],
                ]); ?>

In popup I get conflict, when use DatePicker in form:

<?= $form->field($model, 'date')->widget(DatePicker::className(), [
            'clientOptions' => [
                'class' => 'form-control',
            ],
        ]) ?>`
Q A
Yii vesion 2.0.9
PHP version 5.4.45
Operating system Linux

Date discreapncies between Formatter::asDate() and FormatConverter::convertDateIcuToJui() discrepancies

This issue has originally been reported by @tom-- at yiisoft/yii2#9312.
Moved here by @cebe.


I noticed the following differences when using jQuery-UI Datepicker. Formatter was providing the date input's initial value on page load and the format changed after using Datepicker.

Both are ICU 'medium'.

locale asDate() convertDateIcuToJui()
en-US Apr 4, 2015 Apr 4 2015
ru-RU 04 авг. 2015 г. 04 Авг 2015 г.

or something like that

Selectable add support for begin(), end() widget methods

New feature to allow to make selectable any item, between the begin() and end() widget calls, matching the filter attribute value selector.

Uses:

Selectable::begin([
     'clientOptions' => [
         'filter' => 'my-selectable-item'
         'tolerance' => 'fit',
     ],
 ]);
<ul>
      <li class="my-selectable-item">Item 1</li>
      <li class="my-selectable-item">Item 2</li>
      <li class="no-selectable-item">Item 3</li>
      <li class="my-selectable-item">Item 4</li>
 </ul>
 <div>
      <div>
          <div class="my-selectable-item">Another item </div>
      </div>
 </div>
 Selectable::end();

Can not attach an event to SliderInput create

SliderInput provides a create clientside event. But currently it's not possible to attach a handler there, because the inline code that attaches the event handler comes after the init code for the slider itself - which is too late:

    <?= $form->field($model, 'minPrice')
        ->widget(SliderInput::className(), [
            'clientOptions' => [
                'min' => 0,
                'max' => $priceLimit,
            ],
            'clientEvents' => [
                'create' => $sliderHandler,
            ],
        ]);
    ?>

Leads to this inline js code:

jQuery('#minPrice-container').slider({...});
jQuery('#minPrice-container').on('slidecreate',   function(event, ui) { ... });

So the clientEvents should be attached first, then the widget should be initialized.

How to make sortable with an HTML table ?

Here is my code to create a sortable widget in a table

echo Sortable::widget([
        'items' => [
            ['content' => '<td width="100">Item 1</td>'],
            ['content' => '<td width="100">Item 2</td>'],
            ['content' => '<td width="100">Item 3</td>'],
            ['content' => '<td width="100">Item 4</td>'],
        ],
        'options' => ['tag' => 'table'],
        'itemOptions' => ['tag' => 'tr', 'style' => 'cursor:pointer'],
    ]);

But the result is class ui-sortable-handle will be placed inside tbody, not tr. So I came up with this code

echo '<table class="table table-hover table-striped">';
    echo Sortable::widget([
        'items' => [
            ['content' => '<td width="100">Item 1</td>'],
            ['content' => '<td width="100">Item 2</td>'],
            ['content' => '<td width="100">Item 3</td>'],
            ['content' => '<td width="100">Item 4</td>'],
        ],
        'options' => ['tag' => 'tbody'],
        'itemOptions' => ['tag' => 'tr', 'style' => 'cursor:pointer'],
    ]);
echo "</table>";

What is the proper way other than making my own sub-widget?

Q A
Yii version 2.0.9
PHP version 5.5
Operating system OS X 10.10

How append Class

i want to customized datepicker via my own classes how should i add my own class via configuration?

查询

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii vesion
PHP version
Operating system

Composer Problem

What steps will reproduce the problem?

composer diagnose
Checking composer.json: WARNING
require.yiisoft/yii2 : unbound version constraints (>=2.0.4) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
$ composer require --prefer-dist yiisoft/yii2-jui

What do you get instead?

Your requirements could not be resolved to an installable set of packages.

Problem 1
- yiisoft/yii2-jui 2.0.6 requires bower-asset/jquery-ui 1.11.@stable -> no matching package found.
- yiisoft/yii2-jui 2.0.5 requires bower-asset/jquery-ui 1.11.
@stable -> no matching package found.
- yiisoft/yii2-jui 2.0.4 requires bower-asset/jquery-ui 1.11.@stable -> no matching package found.
- yiisoft/yii2-jui 2.0.3 requires bower-asset/jquery-ui 1.11.
@stable -> no matching package found.
- yiisoft/yii2-jui 2.0.2 requires bower-asset/jquery-ui 1.11.@stable -> no matching package found.
- yiisoft/yii2-jui 2.0.1 requires bower-asset/jquery-ui 1.11.
@stable -> no matching package found.
- yiisoft/yii2-jui 2.0.0 requires bower-asset/jquery-ui 1.11.*@stable -> no matching package found.
- Installation request for yiisoft/yii2-jui ^2.0 -> satisfiable by yiisoft/yii2-jui[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6].

Potential causes:

jui draggable event

This issue has originally been reported by @midcore-nam at yiisoft/yii2#11916.
Moved here by @samdark.


What steps will reproduce the problem?

jui draggable events doesn't start.

What is the expected result?

events should start.

What do you get instead?

event doesn't start.

Additional info

i found out that jqueryui had changed their event name. it is 'drag' instead of 'draggable'.

Q A
Yii version 2.0.8
PHP version 7
Operating system win 10

Spinner buttons invisible

After this update, the up/down buttons of the Spinner widget will be unvisible. The buttons are there and they work, but they're just not visible.

To reproduce, just have a page with a Spinner widget on it, and upgrade yii2-jui to version 2.0.7.

The issue is the result of a subtle conflict between jquery-ui.js 1.12.x and bootstrap.js. It is explained in detail here.

As a workaround, make JuiAsset load version 1.11.4 of jquery-ui in stead of version 1.12.1 (for instance via the assetManager app-component).

Yii version 2.0.13
PHP version 7.1.7
Windows 10
(but it will apply to other versions as well)

Autocomplete Error

Uncaught RangeError: Maximum call stack size exceeded

Q A
Yii 2
PHP version 7

JUI uses legacy JQueryUI release?

Composer dependency of JUI require
"bower-asset/jquery-ui": "1.11.*@stable"
while current jQueryUI stable version is 1.12.1

I want to use 'classes' option of Widget Factory, but it's available only in 1.12+ versions of jQueryUI.
Composer can't update JUI to this version now. Do I really have to install this version manually?

Support for SliderInput range

It would be great if we could use the SliderInput widget like this:

// Model attribute
public $priceRange = [0, 1000];

// Form:
$form->field($model, 'priceRange')
    ->widget(SliderInput::className(), [
        'clientOptions' => [
            'range' => true,
            'min' => 0,
            'max' => 1000,
        ],
    ]);

With the current implementation this gives an "Array to string conversion" exception.

Request to include an option to specify template or class for the ul tag in the tabs widget

When I'm using the Tabs widget, I'm able to specify a css class by using: options, itemOptions,
headerOptions and clientOptions properties but none of these set a class to the ul tag.

echo Tabs::widget([
        'items' => [
            [
                'label' => 'Tab one',
                'content' => 'Mauris mauris ante, blandit et, ultrices a, suscipit eget...',
            ],
        ],
        'options' => ['tag' => 'div','class' => 'class_a'],  #Applied on DIV tag
        'itemOptions' => ['tag' => 'div','class' => 'class_b'], #Applied on DIV tag (content for each LI tag)
        'headerOptions' => ['class' => 'class_c'], #Applied on LI tag
        'clientOptions' => ['collapsible' => false],

        'class' =>  'CUSTOM_UL_CLASS'  #This would allow me to set a custom UL class
    ]);

Is there a way to set a custom class in the UL tag? otherwise could you include this option on your code?

Does not work with bower-asset directory

I have 2 installs with jquery-ui. My development box has vendor/bower/jquery-ui - it works fine.

My test box has vendor/bower-asset/jquery-ui and this does not work, I get:

Invalid Parameter – yii\base\InvalidParamException
The file or directory to be published does not exist: _________/app/vendor/bower/jquery-ui

I have completely reinstalled vendor directories with "composer install" and the exact same composer.json & composer.lock files on both systems & they still reinstall to bower and bower-asset, respectively, I'm not a composer expert and don't really want to spend the time to figure out why they are different.

But this should work no matter where it is installed, all the standard jquery stuff does.

The work around is simple:

cd vendor
ln -s bower-asset bower

CDN jquery-ui.min.js not loadded in bootstrap modal or renderAjax

This issue has originally been reported by @hirenbhut93 at yiisoft/yii2#12742.
Moved here by @samdark.


What steps will reproduce the problem?

I used CDN api for jquery-ui.min.js & jquery-ui.min.css like

'bundles' => [
    'yii\jui\JuiAsset' => [
        'css' => [
            YII_ENV_DEV ? 'themes/smoothness/jquery-ui.css' : '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css',
        ],
        'js' => [
            YII_ENV_DEV ? 'jquery-ui.js' : '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js',
        ],
    ],
],

I have used yii\jui\DatePicker in my bootstrap modal like.

<?= $form->field($user, 'dob')->widget(DatePicker::className(), [
    'clientOptions' => [
        'changeMonth' => true,
        'changeYear' => true,
    ],
    'options' => [
        'class' => 'form-control',
        'readOnly' => true,
    ],
]) ?>

I use renderAjax in my controller action.

However display error message TypeError: jQuery(...).datepicker is not a function.

When i disabled/remove CDN of JuiAsset work perfectly.

I have many try to resolved this issue but not find any solution.

Why?

Additional info

Q A
Yii version 2.0.9
PHP version 5.6
Operating system UBUNTU

Model attribute has error, but DatePicker doesnt display it

What steps will reproduce the problem?

$model->addError('date', 'test error');
echo $form->field($model, 'date')->widget(DatePicker::class);

What's expected?

Input with datepicker and error text

What do you get instead?

Input with datepicker with no error

How to fix it?

Autocomplete, clientOptions, source with callback

My Code:
\yii\jui\AutoComplete::widget([ 'id' => 'player_search_input', 'clientOptions' => [ 'minLength' => 3, 'source' => "function(request, response){console.log('asd');}" ] ]);
Page Source Code:
jQuery('#player_search_input').autocomplete({"minLength":3,"source":"function(request, response){console.log(\u0027asd\u0027);}"});

As you can see: console.log(\u0027asd\u0027); - not need))
So. How I'm can disable qoutting there?


SamDark, Как это безобразие выключить то? Я ж хочу сырой код получить, без обработчиков
С дубляжом на русский)

Datepicker no Working with Pjax.

When you first open the gridview works fine, the datepricker open, once the gridview with pjax the datepicker stops no working, the script is not registered properly, any way to fix it.

Image Datepicker Working:

jui-datepicker-working

Image Datepicker No Working after filtering:

jui-datepicker-no-working

ui Dialog bootstrap require ?

This issue has originally been reported by @i-skiba at yiisoft/yii2#13505.
Moved here by @cebe.


What steps will reproduce the problem?

Now Dialog requires bootstrap.js because in init method

namespace yii\jui;

class Dialog extends Widget
{
....

public function init()
    {
        parent::init();
        echo Html::beginTag('div', $this->options) . "\n";
        
        //Fix for closing icon (x) not showing up in dialog
        $this->getView()->registerJs("
            var bootstrapButton = $.fn.button.noConflict(); 
            $.fn.bootstrapBtn = bootstrapButton;", 
            \yii\web\View::POS_READY
        );
    }
.....
}

after update to 2.0.11 our project throws javascript exception


 is not function a $.fn.button.noConflict()

What is the expected result?

But we dont use bootstrap in our project

What do you get instead?

Please, back clear init without any js

Q A
Yii version 2.0.11
PHP version 5.6
Operating system Debian

Controller id not show in model

What steps will reproduce the problem?

I have 2 different controller and in login model i want to switch to corret db in base at controller->id

class LoginModel extends \yii\db\ActiveRecord{
public static function getDb() {
if(Yii::$app->controller->id==="controller1"){
return Yii::$app->db1;
} else if(Yii::$app->controller->id==="controller2"){
return Yii::$app->db2;
}
}

}

What's expected?

Trying to get property of non-object

Yii::$app->controller = NULL

What do you get instead?

No exception and Yii::$app->controller->id = controller1

Additional info

In yii2 version 2.0.7 the problem not exist.

Q A
Yii vesion 2.0.15-dev
PHP version 5.5.17
Operating system Windows Server 2008 R2

f.getClientRects is not a function

What steps will reproduce the problem?

$("#qqq").dialog("open")

What's expected?

opens a dialog

What do you get instead?

f.getClientRects is not a function

Additional info

Q A
Yii vesion 2.0.13
PHP version 7.1
Operating system debian 8

AssetManager - cache busting timestamp not generated for DatePickerLanguageAsset

Moved from yiisoft/yii2#7955

When using the DatePickerLanguageAsset the timestamp for cache busting is not generated. See the following sample.

<script src="/assets/5e77cca1/yii.js?v=1427914473"></script>
<script src="/assets/5e77cca1/yii.validation.js?v=1427914473"></script>
<script src="/assets/cc5c2917/jquery-ui.js?v=1427915414"></script>
<script src="/assets/cc5c2917/ui/i18n/datepicker-de.js"></script>
<script src="/assets/5e77cca1/yii.activeForm.js?v=1427914473"></script>
<script src="/assets/b62c97e8/js/bootstrap.js?v=1427914473"></script>

Why not?

DatePicker transforms some invalid user input into invalid dates

In some cases (see example below) DatePicker transforms invalid user input into invalid date. Instead exact invalid user input must remain in the field.

Example:
Yii::$app->formatter->dateFormat is set to 'php:Y-m-d'
Date validator is set as:
['someDate', 'date']
DatePicker is rendered as:
<?= $form->field($model, 'someDate')->widget(DatePicker::className()) ?>

When user enters value '1234567' into DatePicker input field and submits the form that input field incorrectly displays '1970-01-15' instead of original user input '1234567'. This happens because the following code tries to format value '1234567' using Yii::$app->formatter->asDate() which in turn tries to parse its first argument as UNIX timestamp value:

    protected function renderWidget()
    {
        // ..........
        if ($value !== null && $value !== '') {
            // format value according to dateFormat
            try {
                $value = Yii::$app->formatter->asDate($value, $this->dateFormat);
            } catch(InvalidParamException $e) {
                // ignore exception and keep original value if it is not a valid date
            }
        }

Don't know how to work around that problem and I think to fix it a significant redesign of DatePicker will be needed.

Droppable and draggable events not working

What steps will reproduce the problem?

Attached clientEvents to Droppable widget like this:
"clientEvents" => [ "drop" => "function (event, ui) { alert(ui); }" ]

What's expected?

Expected an alert when the item is dropped at the area.

What do you get instead?

No alert popped.

Additional info

jQuery added inline at the end of the page uses another set of event names:
Query('#omitted_services').on('droppabledrop', function (event, ui) { alert(ui); });

Same thing happens with Draggable events.

Q A
Yii vesion 2.0.9
PHP version 7.0.7
Operating system Ubuntu

jui datepicker not working properly on pjax

Hi
I need datepicker for yii2 gridview. So i choose jui. It was working perfect on the page reload. When i choose pjax, every time when the datepicker value changes my automatically reloads. Without the datepicker it was working my page not reloaded. Can you point me anything i did work?

For reference i put my code here:

`

                Pjax::begin();

        echo GridView::widget([
            'dataProvider'  => $dataProvider,
            'filterModel'   => $searchModel,
            'columns'       => [
                ['class'        => 'yii\grid\SerialColumn'],
                [
                    'attribute' =>  'td_created_datetime',
                    'filter'        =>  \yii\jui\DatePicker::widget([
                        'model'         =>  $searchModel,
                        'attribute'     =>  'td_created_datetime',
                        'language'      =>  'en',
                        'dateFormat'    =>  'yyyy-MM-dd',
                        'clientEvents'  => [
                            'change'        => "function(e){ 
                                alert('occured');
                                e.preventDefault(); 
                            }"
                        ],
                    ]),
                ],
            ],
        ]); 
        Pjax::end();` 

hhkj

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii vesion
PHP version
Operating system

Spinner can not display spinner button

What steps will reproduce the problem?

Spinner ' button disappeared.

What's expected?

What do you get instead?

Additional info

Q A
Yii vesion 2.0.13.1
PHP version 7.1
Operating system CentOS 7

AutoComplete jquery conflict

What steps will reproduce the problem?

Upgrade yii2 to 2.0.13, jquery updates 2->3

What do you get instead?

AutoComplete show value list in wrong position

Additional info

Q A
Yii vesion 2.0.13
PHP version 7

request for add new prefix on dateFormat

I'm fighting to format date in DatePicker. I like to set dateFormat in js manner without any transformation. so in my project I have subclassed datePiker and changed the run method from line 142:

            if (strncmp($this->dateFormat, 'php:', 4) === 0) {
                    $this->clientOptions['dateFormat'] = FormatConverter::convertDatePhpToJui(substr($this->dateFormat, 4));
            } else {
                    $this->clientOptions['dateFormat'] = FormatConverter::convertDateIcuToJui($this->dateFormat, 'date', $language);
            }

to:

            if (strncmp($this->dateFormat, 'php:', 4) === 0) {
                    $this->clientOptions['dateFormat'] = FormatConverter::convertDatePhpToJui(substr($this->dateFormat, 4));
            } else if (strncmp($this->dateFormat, 'js:', 3) === 0) {
                    $this->clientOptions['dateFormat'] = substr($this->dateFormat, 3);
            } else {
                    $this->clientOptions['dateFormat'] = FormatConverter::convertDateIcuToJui($this->dateFormat, 'date', $language);
            }

I think that this can be usefoul and work very well.
Can you put this change in your code?

When $app->language is set as 'en-US', it fails to load ui/i18n/datepicker-en.js

What steps will reproduce the problem?

Set $app->language = 'en-US', use DatePickerWidget anywhere in page.

What's expected?

If language JS file doesn't exist, it shouldn't be included.

What do you get instead?

404 not found error in javascript console of the browser.

Additional info

Q A
Yii vesion 2.0.13.1
PHP version 7.1.4
Operating system macOS Sierra

DatePicker setting empty field for value == NULL too restrictive

Hey,

DatePicker sets an empty field for value == NULL. However many real world cases will have database entries of empty strings ('') for columns with no dates. Having these fields default to 01/01/1970 is an issue.

Maybe this has already been discussed but I think the DatePicker widget should be less restrictive and check for value == NULL || value == ''. If a user really wanted 01/01/1970 they could set their db default as 0 or "0"

I'm saying this because some databases will not allow you to NULL a db field set as String or Int. But in the absolutely rare event that you actually did want to display the date of 01/01/1970 0 would still be an option.

I will most likely make a pull request since I think it'll be an easy fix. Feel free to ignore/reject it if I'm missing something crucial

change event dose not work

datepicker is configed as follow
'clientEvents' => [
'change' => 'function () { alert('event "change" occured.'); }'
],
it doesnt work.

i find the 96 line code in the file yii2-jui\widget.php

            if (isset($this->clientEventMap[$event])) {
                $eventName = $this->clientEventMap[$event];
            } else {
                $eventName = strtolower($name . $event);
            }

will produce the js like the following:

          jQuery('#w1').on('datepickerchange', function () {....}

the event datepickerchange dose not exist.

change 96 line code to
$eventName = strtolower($event);
will work.

is this a bug or any other use ?

How would I add a class?

How would I add a bootstrap class to input
<?= $form->field( $model, 'birthday' )->widget( \yii\jui\DatePicker::classname(), [ 'language' => 'ru', 'dateFormat' => 'yyyy-MM-dd', 'class' => 'form-control',] ) ?>

This method does not work. Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.