Strange behaviour of Datepicker

QuestionsStrange behaviour of Datepicker
pcattani asked 2 weeks ago

I have three datepickers I’m using in a modal edit form.  The first two datepickers work fine, but the third one doesn’t work.

When I try to use the third datepicker, I can browse a new date normally, but when I click on the date, the form scrolls to the top of the screen and the new date is not selected.

I think this may have something to do with it being a field which is offscreen and you have to scroll down to use it.

I am styling the form grid heights manually using:

.FormGrid {
height: 800px !important;
}

So that the scroll bars appear.  This is the only relevant information I can think of at this time.

 

Any ideas how to fix?

 

 

 

5 Answers
pcattani answered 2 weeks ago

Update:   I changed another field after the first two dates to a datepicker, and it behaves normally.  So this lends more credence to the idea that it has something to do with the form being scrolled down.   One other thing: I was wrong, the date on the weird datepicker *does* update when it is selected.  It\\\’s just that the form scrolls to the top for some reason.

Abu Ghufran Staff answered 6 days ago

Hi,

This is a known issue and a quick fix is to set dialog modal to false:

$opt["add_options"]["modal"] = false;
$opt["edit_options"]["modal"] = false;
...
$g->set_options($opt);

Update: New solution retains modal dialog behavior and enable datepickers:

$opt["add_options"]["jqModal"] = false;
$opt["edit_options"]["jqModal"] = false;
...
$g->set_options($opt);
_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
pcattani answered 6 days ago

Hi Abu,   Thanks for the reply.  Yes, that does fix the problem.  Unfortunately, it\’s not a great idea to have a click outside the form cancel the form.  Users could have entered a lot of information in that area.   Is there any javascript hack you\’re aware of that would prevent a click from closing the form?   Thanks again,   pcattani

Abu Ghufran Staff answered 5 days ago

After your request, i reviewed the solution further and found a better solution.

Instead of above said “modal” property, if you set “jqModal” following to false, it will still behave as modal with working datepickers.

$opt["add_options"]["jqModal"] = false; 
$opt["edit_options"]["jqModal"] = false;
// ...
$g->set_options($opt);

This change is incorporated in latest build now as well.

Ref: https://stackoverflow.com/a/12282798/385377

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
pcattani answered 5 days ago

That works perfectly!   Thanks for looking in to this and thanks for the update.  Very much appeciated!

Your Answer

11 + 14 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?