Adding onchange to date type field causes datepicker to disappear.

QuestionsAdding onchange to date type field causes datepicker to disappear.
Jim asked 5 years ago

When I try to add a onchange event to a date field (vs a drop down) so
that  when  user  selects  different date from datepicker icon it then
effects  another  field  drop down, it works but I lose the datepicker
functionality  (the  small  calendar  icon  disappears).   I  have  to
manually select a date then by typing in date manually into date field
and  it works great in that it refreshes/updates the drop down for the
other  field,  but  I  would  like to retain the datepicker icon/popup
calendar functionality.
Thoughts?
Here is my example code for the date field, again it works great but I
lose  datepicker popup calendar icon/functionality from the date field
now, but I can manually enter date and onchange works still:
———
$col = array();
$col[“title”] = “Date”;
$col[“name”] = “s_date”;
$col[“width”] = “75”;
$col[“formatter”] = “date”;
$col[“editable”] = true; // this column is editable
$col[“editoptions”] = array(
20, “defaultValue” => date(“Y-m-d”),
array(    “sql”=>
“select  the_id  as  k,  the_name  as  v  from
customers where the_date = ‘{s_date}'”,
“update_field” => “s_account_id” ));
$cols[] = $col;
———

8 Answers
Abu Ghufran Staff answered 5 years ago

Hello,

This is not supported now in datepicker. I tested this code in latest version and it freezes up. Don’t know how it is working on your side. If you can tell your version, i can try regenerating / updating code.

PS: Your email address is not listed in our system, so kindly email me at [email protected] your contract details.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 5 years ago

Just found your direct email as well. I’ll check and update back.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Jim answered 5 years ago

So there is no way to make onchange event work on datepicker/date field is that what you are saying?

Jim answered 5 years ago

So there is no way to make onchange event work on datepicker/date field is that what you are saying?

Jim answered 5 years ago

Also version I am using is:

2.2.5 build 20171031-2254

Jim answered 5 years ago

Anything that can be done here for this datepicker issue when onchange is used with it?

Abu Ghufran Staff answered 5 years ago

Hi Jim,

Apologies for the delay in updating back.

Issue is i am unable to get this behavior on latest 2.6.3 build. I need to compare both versions first and see what is limiting it and update you back after merging / testing your exact need.

It may take some time and ticket will remain open for updates.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 5 years ago

You can connect add / edit dialog afterShowForm event and reconnect datepicker to that field.

$opt[“add_options”][“afterShowForm”] = “function(){ link_date_picker($(‘#invdate’),’yy-mm-dd’); }”;
$opt[“edit_options”][“afterShowForm”] = “function(){ link_date_picker($(‘#invdate’),’yy-mm-dd’); }”;
$g->set_options($opt);

Here invdate is field name.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

16 + 12 =

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?