add active user name in grid

Questionsadd active user name in grid
sadegh asked 6 months ago

I want to read the user name from the session, and then put a function in one of the columns at the time of calling the  add function.

1 Answers
Abu Ghufran Staff answered 6 months ago

To set session value in some field while showing add form, you can set it as default value. e.g.

$col[“name”] = “userid”;
$col[“editoptions”][“defaultValue”] = $_SESSION[“userid”];

and you can make such field hidden as well, $col[“hidden”] = true;

If you want to set it after postback, you can use on_insert event and set it there.

$e[“on_insert”] = array(“add_client”, null, true);

function add_client(&$data) {
$data[“params”][“userid”] = $_SESSION[“userid”];

Refer and demo code for help.

Abu Ghufran - Dev Team
PHP Grid Framework
Your Answer

6 + 3 =

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 / 5. Vote count:

As you found this post useful...

Follow us on social media!

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

Let us improve this post!