add active user name in grid

Questionsadd active user name in grid
sadegh asked 4 years 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 4 years 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
Grid 4 PHP Framework
Your Answer

9 + 17 =

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?