put virtual column in first column

Questionsput virtual column in first column
Adrian Sirbu asked 4 years ago

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!

1 Answers
Abu answered 4 years ago

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.

Your Answer

0 + 8 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?