Problem with add dialog box with 2 date fields ONLY IF the date is the first field in the dialog box

QuestionsProblem with add dialog box with 2 date fields ONLY IF the date is the first field in the dialog box
Alexander asked 7 years ago

This code works perfectly (date field not in first position):

$g = new jqgrid($db_conf);

$g->table = "test";

$opt = array();
$opt["caption"] = "Test";
$g->set_options($opt);

$cols = array();

$col = array();
$col["title"] = "ID";
$col["name"] = "ID_test";
$cols[] = $col;

$col = array();
$col["title"] = "Text";
$col["name"] = "Text";
$col["editable"] = true;
$cols[] = $col;

$col = array();
$col["title"] = "Data1";
$col["name"] = "Data1";
$col["editable"] = true;
$col["formatter"] = "date";
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d/m/Y');
$cols[] = $col;

$col = array();
$col["title"] = "Data2";
$col["name"] = "Data2";
$col["editable"] = true;
$col["formatter"] = "date";
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d/m/Y');
$cols[] = $col;

$g->set_columns($cols);

$out_grid_1 = $g->render("list1_1");

and this not (date field in first position):

// grid_1 (Test)
$g = new jqgrid($db_conf);

$g->table = "test";

$opt = array();
$opt["caption"] = "Test";
$g->set_options($opt);

$cols = array();

$col = array();
$col["title"] = "ID";
$col["name"] = "ID_test";
$cols[] = $col;

$col = array();
$col["title"] = "Data1";
$col["name"] = "Data1";
$col["editable"] = true;
$col["formatter"] = "date";
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d/m/Y');
$cols[] = $col;

$col = array();
$col["title"] = "Text";
$col["name"] = "Text";
$col["editable"] = true;
$cols[] = $col;

$col = array();
$col["title"] = "Data2";
$col["name"] = "Data2";
$col["editable"] = true;
$col["formatter"] = "date";
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d/m/Y');
$cols[] = $col;

$g->set_columns($cols);

$out_grid_1 = $g->render("list1_1");

1 Answers
Abu Ghufran answered 7 years ago

Hello,

// modal should be false, if you are using more than 1 datepicker/timepicker controls
$grid["add_options"]["modal"] = false;
$grid["edit_options"]["modal"] = false;

$g->set_options($grid);

Your Answer

2 + 17 =

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?