В моей таблице есть столбец данных:
Код: Выделить всё
data date
id int(11)
...other fields
Код: Выделить всё
$db_conf = array(
"type" => PHPGRID_DBTYPE,
"server" => PHPGRID_DBHOST,
"user" => PHPGRID_DBUSER,
"password" => PHPGRID_DBPASS,
"database" => PHPGRID_DBNAME
);
$g = new jqgrid($db_conf);
function setup_options($g, $table, $title=null) :void {
$caption = $title;
if ($caption == null) $caption = str_replace("_", " ", $table);
$opt["caption"] = ucwords($caption);
$opt["forceFit"] = true;
$opt["rownumbers"] = true;
$opt["rownumWidth"] = 50;
$opt["autoresize"] = true;
$opt["autowidth"] = true;
$opt["resizable"] = false;
$opt["height"] = "100%";
$opt["globalsearch"] = true;
$opt["toolbar"] = "bottom";
$opt["toppager"] = false;
$opt["pgbuttons"] = true;
$opt["cellEdit"] = true;
$opt["reloadedit"] = true;
$g->table = $table;
$g->set_options($opt);
$g->set_actions(array(
"add" => true,
"delete" => true,
"edit" => true,
"autofilter" => true,
"search" => "simple",
"export_excel" => true,
"export_pdf" => true,
"export_csv" => true,
"export_html" => true,
));
}
function setup_table($g): void {
$col = array();
$col["name"] = "data";
$col["formatter"] = "date";
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d/m/Y');
$cols[] = $col;
$col = array();
$col["title"] = " ";
$col["name"] = "more_actions";
$col["fixed"] = true;
$col["width"] = "40";
$col["align"] = "center";
$col["search"] = false;
$col["sortable"] = false;
$buttons_html = '[url=javascript:void(0);][/url]';
$col["default"] = $buttons_html;
$cols[] = $col;
$g->set_columns($cols, true);
}
$g->select_command = "custom query";
setup_options($g, "mytable");
setup_table($g);
$table = $g->render("mytable");
?>
function copy_to_fixed(data) {
console.log(data)
}
Боюсь, это делает математику даже без eval: 2024 - 9 - 11 = 2004!
Я пробовал с :
Код: Выделить всё
console.log(String(data))Код: Выделить всё
console.log("'" + data + "'"))
Подробнее здесь: https://stackoverflow.com/questions/791 ... n-grid4php
Мобильная версия