Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'dates' of undefined. #96

Closed
jeroenk22 opened this issue Jun 29, 2016 · 6 comments
Closed

Uncaught TypeError: Cannot read property 'dates' of undefined. #96

jeroenk22 opened this issue Jun 29, 2016 · 6 comments

Comments

@jeroenk22
Copy link

Hello Kartik,

Since your last update of Datepicker (v1.4.0) I receive the following JS error:

Uncaught TypeError: Cannot read property 'dates' of undefined.

I'm using Dutch language.

My code:


        <?= DatePicker::widget([
        'name' => 'nieuweDatum',
        'type' => DatePicker::TYPE_BUTTON,
        'language' => 'nl',
        'pluginOptions' => [
            'todayHighlight' => true,
            'autoclose' => true,
            'format' => 'yyyy-mm-dd',
            'calendarWeeks' => true,
            'todayBtn' => true,
        ],                   
            'pluginEvents' => [
                "changeDate" => "function(e) { $.get(datum, {datum: $(this).find('input').val()} ); $.pjax.reload({container: '#planner_grid', timeout: 10000}); }",  
            ]
        ]);?>

@kartik-v
Copy link
Owner

kartik-v commented Jun 29, 2016

The problem is in your plugin events code... you need to check the plugin documentation on how to call the changeDate event.

@jeroenk22
Copy link
Author

Can you please give me a hint? The changeDate event still works like it did before. If I comment out the whole pluginEvents the JS error still persists.. The only difference since the last update is that I can't use Dutch (or whatever language) anymore.

@kartik-v
Copy link
Owner

OK I think I know the issue... Will update

@kartik-v
Copy link
Owner

kartik-v commented Jun 29, 2016

I think this should resolve the issue - check and let know with the updated code from dev-master of the repo and then I will tag this release.

@jeroenk22
Copy link
Author

jeroenk22 commented Jun 30, 2016

Thank you! The problem has been solved.

@intricareruchika
Copy link

intricareruchika commented Jan 2, 2018

i have same issue and i haven't write code of plugin events
my code is..

field($model, 'date_of_join')->widget(DatePicker::classname(), [ 'options' => ['placeholder' => 'Enter birth date ...'], 'name' => 'date_of_join', 'pluginOptions' => [ 'autoclose'=>true ], ----------------------------- issue is=Uncaught TypeError: Cannot set property 'dates' of undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants