Hi,
$col = array();
$col["title"] = "Options";
$col["name"] = "more_options";
$col["width"] = "30";
$col["align"] = "center";
$col["search"] = false;
$col["sortable"] = false;
# no new line in this html, only space. otherwise it may break ui of grid
$buttons_html = "<a target='_blank' href='1.php?id={id}' style='text-decoration:none; white-space:none; border:1px solid gray; padding:2px; position:relative; width:25px; color:red'>Button1</a> <a target='_blank' href='2.php?sid={id}' style='text-decoration:none; white-space:none; border:1px solid gray; padding:2px; position:relative; width:25px; color:green'>Button2</a>";
$col["default"] = $buttons_html;
$cols[] = $col;
I use above code for displaying buttons every row. Can I make it to display conditionally? For ex, if col1 = 10, only then display the buttons?
For extended conditional data, you can also have callback function, that will allow you to display based on row data. For e.g.
$col["on_data_display"] = array("display_keyword","");
function display_keyword($data)
{
$kw = $data["keyword_name"];
$numKeywords = count(explode("n",$pass));
if ($numKeywords > 3)
return $numKeywords." Keywords";
else
{
$pass = str_replace("+"," ",$pass);
return $pass;
}
}
Thanks,
But I want to display first button always but conditionally display the second button? Do I need to use separate column for this or is there a solution?
Alternate column is not necessary.
Code would be something like: http://pastebin.com/DjNjMEgh