I'm trying to assign a placeholder to a variable inside the cols1[] and it's not working. Placeholders will work inside of col["links"] but not directly to a variable.. Am I missing something?
$col1 = array();
$col1["title"] = "Order #";
$col1["name"] = "orderid";
$col1["width"] = "20";
$col1["editable"] = true;
$orderid = "{orderid}"; <<—— Not working
$cols1[] = $col1;
$col1 = array();
$col1["title"] = "BOL"; // caption of column
$col1["name"] = "bolnumber"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col1["width"] = "10";
$col1["editable"] = false;
$col1["link"] = 'javascript:window.open("assignbol.php?order={orderid}","newwind","height=800,width=800"); void(0);';
$cols1[] = $col1;
To use placeholder in any column display, you need to use 'default' property.
$col["default"] = "order id : {orderid}";
I'm sorry, I guess I should have explained by intentions for the variable. I'm trying to execute a mysql variable before the 2nd column. It's going to see if there is a bol number assigned, if not it's going to return a different link in the 2nd column. I've tried a bunch of different ways and can't get orderid to return any value. Here is my current code:
$col1 = array();
$col1["title"] = "Order #";
$col1["name"] = "orderid";
$col1["width"] = "20";
$col1["editable"] = true;
$ordid = "{orderid}";
$cols1[] = $col1;
$result = mysql_query("SELECT * FROM boltracking WHERE ordernum = '$ordid'") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$bolnum = $row['bol_num'];
}
if ($bolnum == "") {
$bolnum = "Assign";
}
$col1 = array();
$col1["title"] = "BOL";
$col1["name"] = "bolnumber";
$col1["width"] = "10";
$col1["editable"] = false;
$col1["default"] = $bolnum;
if ($bolnum == "Assign") {
$col1["link"] = 'javascript:window.open("assignbol.php?order={orderid}","newwind","height=800,width=800"); void(0);';
} else {
$col1["link"] = 'javascript:window.open("bolmaker.php?order={orderid}","newwind","height=800,width=800"); void(0);';
}
$cols1[] = $col1;
You can try column event of on_data_display. Example code is mentioned on link.
I've not tested this code and it is just to give you idea of usage.