Visual Dateformatting issues – Different visual datepickers same row

QuestionsVisual Dateformatting issues – Different visual datepickers same row
Mario Verleene asked 4 years ago

Why isn’t this working ???

Mysql date format : YYYY-MM-DD

$col[“title”] = “Pmaand”;
$col[“tooltip”] = “Planningsmaand”;
$col[“name”] = “planningmaand”;
$col[“width”] = “3”;
$col[“editable”] = true;
//$col[“editoptions”] = array(“size”=>20, “defaultValue” => date(“M Y”));
$str = $grid->get_dropdown_values(“SELECT planningmaand as k, DATE_FORMAT(planningmaand, ‘%b %Y’) as v FROM XXL_2020Y group by planningmaand”);
$col[“searchoptions”] = array(“value”=>”:;”.$str);
$col[“stype”] = “select-multiple”;
$col[“formatter”] = “date”;
$col[“align”] = “right”;
$col[“formatoptions”] = array(“srcformat”=>’Y-m-d’,”newformat”=>’m/Y’, “opts” => array(“changeYear” => true, “changeMonth” => true, “dateFormat”=>’yy/mm/dd’));
$col[“hidden”] = false;
$cols[] = $col;

This is just the VISUAL aspect of the date that isn’t working. The data itself is being saved to mysql database.

this is AFTER selecting a date from the datepicker with:

dateFormat : dd-mm-yyyy

afterdatepicker  : 2020/10/01

after save: 01/2020 (???)

dateFormat : mm-dd-yyyy

afterdatepicker : 2020/10/01

after save: 10/2001 (???)

dateFormat : yyyy-mm-dd

afterdatepicker : 2020/10/01

after save : 04/2178 (???)

What am I doing wrong??? because the date is perfectly saved to the database. When refreshing the grid I get perfect display of : 10/2020

Also is it possible to only get a selection for MONTH YEAR only ? (I have 3 datepickers in one row)

Thanks in advance

 

3 Answers
Abu Ghufran Staff answered 4 years ago

I reviewed your issue and it seems to be a bug at JS level. However after refresh it works.

So there is a quick fix to reload data after each edit, you can set:

$opt[“reloadedit”] = true;
$g->set_options($opt);

 

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Mario Verleene answered 4 years ago

Thanks Abu, for the quick response and quick fix. Hopefully this will be resolved in next release?

As for my other question : I currently have 3 datepickers on one row. Is it possible to change one view in that it only displays month/year selection?

Javascript :

$(function() {
$(‘.date-picker’).datepicker( {
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: ‘MM yy’,
onClose: function(dateText, inst) {
$(this).datepicker(‘setDate’, new Date(inst.selectedYear, inst.selectedMonth, 1));
}
});
});

CSS :

.ui-datepicker-calendar {
display: none;
}

but when implemented it changes ALL the datepickers. How can I keep default format for the two others?

best regards,

 

Abu Ghufran Staff answered 4 years ago

You need to change jQuery selector from $(‘.date-picker’).datepicker(..) to the ID of the datepicker input box.

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

18 + 16 =

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?