Show a related name and not ID in the list

QuestionsShow a related name and not ID in the list
Mattias Cederlund asked 10 years ago

Hi!

I am making a list where i am choosing users for particular events. I want the list to save a User_ID – but to show the name. I cannot find out how to do that.

Here is what i write:
$col = array();
$col["title"] = "Customer Account Manager";
$col["name"] = "CustomerAccountManagerId";
$col["editable"] = true;
$col["width"] = "80";
$col["edittype"] = "select"; // render as select
# fetch data from database, with alias k for key, v for value
$str = $g->get_dropdown_values("select distinct User_Id as k, User_Name as v from user where UserGroup=6");
$col["editoptions"] = array(
"value"=>$str,
"onchange" => array(
"sql"=>"select * from user",
"search_on"=>"User_Id",
"callback" => "fill_form" )
);
$col["stype"] = "select"; // enable dropdown search
$col["searchoptions"] = array("value" => ":;".$str);
$cols[] = $col;

And – when i use the dropdown i see the name – but i want to see the name in the list also – but save the UserID.

Hope you can assist.

/Mattias

1 Answers
Abu Ghufran answered 10 years ago

You need to set:

$col["formatter"] = "select";

Your Answer

17 + 15 =

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?