Dropdown dependent multiple fields

QuestionsDropdown dependent multiple fields
Gustavo Lazaro asked 4 years ago

Dear Abu. Is there a possibility that a field $ g-> get_dropdown_values, in the WHERE clause can put the value of two fields that have data previously entered?

Example:

$col = array();
$col[“title”] = “Date”;
$col[“name”] = “date”;
$col[“editable”] = true;
$col[“editrules”] = array(“required”=>true);
$cols[] = $col;

$col = array();
$col[“title”] = “Name”;
$col[“name”] = “name”;
$col[“editable”] = true;
$col[“editrules”] = array(“required”=>true);
$cols[] = $col;

$col = array();
$col[“title”] = “Mach”;
$col[“name”] = “codPartido”;
$str = $g->get_dropdown_values(“SELECT codpartido AS k, fecha AS v FROM partidos WHERE name='{name}’ AND date='{date}'”);
$col[“stype”] = “select”;
$col[“searchoptions”] = array(“value” => $str, “separator” => “:”, “delimiter” => “;”);
$col[“edittype”] = “select”;
$col[“editoptions”] = array(“value” => $str, “separator” => “:”, “delimiter” => “;”);
$col[“formatter”] = “select”;
$col[“editable”] = true;
$cols[] = $col;

Thanks.
1 Answers
Abu Ghufran Staff answered 4 years ago

Hi,

You can get desired results with:

 

$col = array();
$col[“title”] = “Mach”;
$col[“name”] = “codPartido”;
$str = $g->get_dropdown_values(“SELECT codpartido AS k, fecha AS v FROM partidos”);
$col[“stype”] = “select”;
$col[“searchoptions”] = array(“value” => $str, “separator” => “:”, “delimiter” => “;”);
$col[“edittype”] = “select”;
$col[“editoptions”] = array(“value” => $str, “separator” => “:”, “delimiter” => “;”);
$col[“editoptions”][“dataInit”][“sql”] = “SELECT codpartido AS k, fecha AS v FROM partidos WHERE name='{name}’ AND date='{date}'”;
$col[“formatter”] = “select”;
$col[“editable”] = true;
$cols[] = $col;

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

9 + 18 =

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?