I have an array full fo windows directory information, and i would like to fill a few columns with that array information based on the “row” information. I would hope the answer is simple, but i am having a heck of a time figuring it out.
// DL DWG NUM
$col = array();
$col[“title”] = “DWG NO.”;
$col[“name”] = “dl_dwg_num”;
$col[“hidden”] = false;
$col[“export”] = true;
$col[“editable”] = true;
$col[“editoptions”][“defaultValue”] = $q_info2[‘unit_number’] . “-“; //DEFAULT TEXT
$col[“width”] = “100”;
$cols[] = $col;
$key = array_search(‘{dl_dwg_num}’, array_column($files, ‘db_dl_name’));
// FILE REV NUMBER
$col = array();
$col[“title”] = “File Rev Letter”;
$col[“name”] = “File_Rev_Letter”;
$col[“hidden”] = false;
$col[“export”] = true;
$col[“editable”] = true;
$col[“default”] = $files[$key][‘rev_letter’];
$col[“width”] = “100”;
$cols[] = $col;
I need to read the colunm “dl_dwg_num” and search an array – and place that information from the array in column “File_Rev_Letter”
Please help
Thanks in advance,
Tim
Hi,
In the column options of File_Rev_Letter, You can add following:
$col["on_data_display"] = array("display_array_info",""); function display_array_info($data) { global $files; $key = array_search($data["dl_dwg_num"], array_column($files, 'db_dl_name')); return $files[$key]["rev_letter"]; }
You can remove the $col[“default”]=… and $key=… lines.