Hi,
I use from How-Tos & FAQs next script:
$col = array();
$col[“title”] = “Id”;
$col[“name”] = “vid”;
$col[“width”] = “400”;
$col[“hidden”] = true;
$cols[] = $col;
$e[“on_data_display”] = array(“filter_display”, null, true);
$g->set_events($e);
function filter_display($data)
{
$i=1;
foreach($data[“params”] as &$d)
{
$d[“vid”] = $i++;
}
}
and next I use
$g->set_columns($cols,true); // for next fields from table
My problem is that “vid” virtual column is in the last column, an I want into first column.
It’s possible to change “vid” position in grid?
Tks!
Hello,
Setting column position is controller when you define columns manually. And when you don’t define columns, display ordering of columns is set by provided sql query. You can now make this virtual column at starting part of your sql query with some blank value. This blank value will never be shown as you can overriding it in event handler.
$g->select_command = “SELECT ” as vid, …. “;
Hope it helps.