hi sir,
dependent drop down onnload after update the onload doesnt work properly in edit.
$col = array();
$col[“title”] = “Bank Name”; // caption of column
$col[“name”] = “bankid”;
$col[“dbname”] = “ADMIN.proc_banktovendor.bankid”; // this is required as we need to search in name field, not id
$col[“width”] = “40”; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col[“editable”] = true;
$col[“search”] = true;
$col[“edittype”] = “select”; // render as select
$col[“isnum”] = true;
$col[“isnull”] = true;
$statuss='”status”‘;
# fetch data from database, with alias k for key, v for value
$strd = $g->get_dropdown_values(“select $bankid as k,$bankname as v from ADMIN.$bankt where $statuss=’AA’ “);
$col[“editoptions”] = array( “value”=>”:;”.$strd,
“onchange” => array(“sql”=>”select distinct $branchid as k, $branchname as v from ADMIN.$branch
inner join ADMIN.$bankt on ADMIN.$bankt.$bankid=ADMIN.$branch.$bankid
WHERE ADMIN.$branch.$bankid=(select $bankid from ADMIN.$bankt where ADMIN.$bankt.$bankid='{bankid}’ and $statuss=’AA’ )”,
“callback” => “update_bank”
)
,”style”=>”width:150px”
);
$col[“editoptions”][“dataInit”] = “function(){ setTimeout(function(){ link_sts(‘{$col[“name”]}’); },200); }”;
$col[“stype”] = “select”;
$col[“searchoptions”] = array(“value” => “:;”.$strd);
$col[“searchoptions”][“dataInit”] = “function(){ setTimeout(function(){ link_sts(‘gs_{$col[“name”]}’); },350); }”;
$col[“formatter”] = “select”;
$col[“formoptions”] = array(“rowpos”=>”8”, “colpos”=>”1”) ;
$cols[] = $col;
$col = array();
$col[“title”] = “Branch Name”; // caption of column
$col[“name”] = “branchid”;
$col[“dbname”] = “ADMIN.proc_banktovendor.branchid”; // this is required as we need to search in name field, not id
$col[“width”] = “40”; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col[“editable”] = true;
$col[“search”] = true;
$col[“edittype”] = “select”; // render as select
$col[“isnum”] = true;
$col[“isnull”] = true;
$statuss='”status”‘;
# fetch data from database, with alias k for key, v for value
$strd = $g->get_dropdown_values(“select $branchid as k,$branchname as v from ADMIN.$branch “);
$col[“editoptions”] = array( “value”=>”:;”.$strd,
“onchange” => array(“sql”=>”select * from ADMIN.$branch WHERE ADMIN.$branch.$branchid='{branchid}’
and ADMIN.$branch.$bankid=(select $bankid from ADMIN.$bankt where ADMIN.$bankt.$bankid='{bankid}’) “,
“callback” => “update_branchid”)
,”style”=>”width:150px”
);
$col[“editoptions”][“dataInit”] = “function(){ setTimeout(function(){ link_sts(‘{$col[“name”]}’); },200); }”;
//$col[“editoptions”][“onload”][“sql”] = “select $branchid as k,$branchname as v from ADMIN.$branch where ADMIN.$branch.$bankid='{bankid}’ and $statuss=’AA'”;
$col[“stype”] = “select”;
$col[“searchoptions”] = array(“value” => “:;”.$strd);
$col[“searchoptions”][“dataInit”] = “function(){ setTimeout(function(){ link_sts(‘gs_{$col[“name”]}’); },350); }”;
$col[“formatter”] = “select”;
$col[“formoptions”] = array(“rowpos”=>”8”, “colpos”=>”2”) ;
$cols[] = $col;
$col = array();
$col[“title”] = “Bank Id “; // caption of column
$col[“name”] = “bankname”; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col[“dbname”] = “ADMIN.proc_banktovendor.bankname”; // this is required as we need to search in name field, not id
$col[“width”] = “120”;
$col[“align”] = “left”;
$col[“search”] = true;
$col[“editable”] = true;
$col[“isnum”] = true;
$col[“isnull”] = true;
$col[“show”] = array(“list”=>false,”edit”=>true,”add”=>true);
$col[“formoptions”] = array(“rowpos”=>”9”, “colpos”=>”1”);
$cols[] = $col;
Hello,
I’m unable to understand this question. Please tell steps to regenerate the case and send me complete code + database dump.
Thanks.
sir,
In our old version we have used the $col[“editoptions”][“onload”][“sql”] method for loading the dependent drop drop down .
In new it doesnt work in new version or i dont know to use correct functionality
Hello,
I’ve tested it and dropdown’s onload sql query works as expected with latest build.
https://gist.github.com/gridphp/48d5f7be375ecdbab9195b1091cfc480#file-dropdown-onload-sql-php-L87