column dropdown from a select

Questionscolumn dropdown from a select
Mario asked 8 years ago

Hello,

I want to use a colums as a dropdown. I looked for sample. The select is working:

select cetc.campaign_id as k, cec.title as v from categories_email_to_campaigns cetc left join categories_email_campaigns cec on cec.campaign_id = cetc.campaign_id ist working.

But how do I get it into the columndropdown, if not like:

————————

$col = array();
$col["title"] = "Kampagnenid";
$col["name"] = "campaign_id";
$col["dbname"] = "categories_email_to_campaigns.campaign_id"; // this is required as we need to search in name field, not id
$col["width"] = "21";
$col["align"] = "left";
$col["search"] = false;
$col["editable"] = true;
$col["edittype"] = "select"; // render as select
# fetch data from database, with alias k for key, v for value
$str = $g->get_dropdown_values("select cetc.campaign_id as k, cec.title as v from categories_email_to_campaigns cetc left join categories_email_campaigns cec on cec.campaign_id = cetc.campaign_id");
$col["editoptions"] = array("value"=>":;".$str);
$col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ $('select[name=campaign_id]').select2({width:'80%', dropdownCssClass: 'ui-widget ui-jqdialog'}); },200); }";
$cols[] = $col;

———
Did I miss anything to make the dropdown work?

Thanx and best regards, Mario

Your Answer

6 + 13 =

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?