I have not been able to get
$g->set_col_default('jobdate', '2017-02-03');
to work and it's not even as complicated as I need it to be.
What I need is THIS during an "ADD RECORD operation".
$g->set_col_default('jobdate', insert todays date into the record);
Every time I put this statement into the code and launch the page, I get a blank white screen.
$g = new jqgrid($db_conf);
$grid["caption"] = "<b>JOBS</b>";
$grid["toolbar"] = "bottom";
$grid["pgbuttons"] = false;
$grid["pgtext"] = null;
$grid["width"] = "1080";
$grid["sortable"] = true;
$grid["sortname"] = "done";
$grid["rowNum"] = 999; // or any of your desired rec/page FINALLY! this works!
$grid["rowList"] = array();
$g->set_options($grid);
$g->table = "jobs";
$col = array();
$col["name"] = "jobid";
$col["title"] = "JobID";
$col["fixed"] = true;
$col["width"] = "60";
$col["editable"] = false;
$cols[] = $col;
$col = array();
$col["name"] = "custid";
$col["title"] = "CustID";
$col["fixed"] = true;
$col["width"] = "60";
$col["editable"] = false;
$cols[] = $col;
$col = array();
$col["name"] = "jobdate";
$col["title"] = "Date";
$col["fixed"] = true;
$col["width"] = "94";
$col["formatter"] = "date";
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'m/d/Y');
$col["align"] = "right";
$cols[] = $col;
$col = array();
$col["name"] = "year";
$col["title"] = "Year";
$col["fixed"] = true;
$col["width"] = "60";
$col["align"] = "right";
$cols[] = $col;
$col = array();
$col["name"] = "make";
$col["title"] = "Make";
$col["fixed"] = true;
$col["width"] = "100";
$cols[] = $col;
$col = array();
$col["name"] = "model";
$col["title"] = "Model";
$col["fixed"] = true;
$col["width"] = "174";
$cols[] = $col;
$col = array();
$col["name"] = "engine";
$col["title"] = "Engine";
$col["fixed"] = true;
$col["width"] = "110";
$cols[] = $col;
$col = array();
$col["name"] = "mileage";
$col["title"] = "Mileage";
$col["align"] = "right";
$col["fixed"] = true;
$col["width"] = "80";
$cols[] = $col;
$col = array();
$col["name"] = "license";
$col["title"] = "License";
$col["align"] = "right";
$col["fixed"] = true;
$col["width"] = "90";
$cols[] = $col;
$col = array();
$col["name"] = "done";
$col["title"] = "Done";
$col["search"] = false;
$col["align"] = "center";
$col["fixed"] = true;
$col["width"] = "60";
$cols[] = $col;
$col = array();
$col["name"] = "memo";
$col["title"] = "Memo";
$col["fixed"] = true;
$col["width"] = "90";
$col["sortable"] = false;
$cols[] = $col;
$col = array();
$col["name"] = "staxrate";
$col["hidden"] = true;
$cols[] = $col;
$col = array();
$col["name"] = "vin";
$col["hidden"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "Action";
$col["name"] = "act";
$col["fixed"] = true;
$col["width"] = "70";
$col["align"] = "center";
$cols[] = $col;
$g->set_columns($cols,true);
$outjobs = $g->render("list1");
//$g->set_col_default('jobdate', '2017-02-03'); // supposed to be used only for add record
// End of JOBS grid definition
Hi,
The function set_col_default does not exist in our library.
Please http://phpgrid.prg/docs for help.
For default value, you need to set: $col["editoptions"]["defaultValue"]
$col = array();
$col["name"] = "jobdate";
$col["title"] = "Date";
$col["fixed"] = true;
$col["width"] = "94";
$col["formatter"] = "date";
$col["editoptions"]["defaultValue"] = '2017-02-03';
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'m/d/Y');
$col["align"] = "right";
$cols[] = $col;