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

Ajax doesn't work with this datePicker #126

Open
mshahrokhi opened this issue Jul 31, 2018 · 2 comments
Open

Ajax doesn't work with this datePicker #126

mshahrokhi opened this issue Jul 31, 2018 · 2 comments

Comments

@mshahrokhi
Copy link

mshahrokhi commented Jul 31, 2018

Hi,
I use this datePicker in my project with angular and in the pages that I used this datePicker, Ajax doesn't work correctly. (An error occurred while attempting to process /system/ajax: this is undefined!)
but in other pages, Ajax calls works correctly and when I remove this datePicker JS file from this pages the error will disappear and Ajax works fine.

please help me with this issue.
thanks

@mshahrokhi
Copy link
Author

I found this issue seems to be the result of this section of JS file ( Line 32 - 47 ):

Array.prototype.toNumber = function() { return this.map(function(item) {return Number(item);}); }; Array.prototype.dtp_toDate = function(type) { var splitter = '-'; if (/invalid/i.test(new Date('1991-9-12'))) splitter = '/'; var date = this.join(splitter); if (this.length == 5) date = this.slice(0,3).join(splitter) +' '+ this.slice(3,5).join(':') if (!type) return date; date = new Date(date); if (type == 'unix') return date.getTime(); return date; };

@mshahrokhi
Copy link
Author

Fortunately, I found that "this" is undefined sometimes in this functions and I added an if statement before any "this" in this section of code and it works fine now.

thanks

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

No branches or pull requests

1 participant