dropdown onload

Questionsdropdown onload
german asked 6 months ago

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;

4 Answers
Abu Ghufran Staff answered 5 months ago

Hello,

I’m unable to understand this question. Please tell steps to regenerate the case and send me complete code + database dump.

Thanks.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
german answered 5 months ago

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

german answered 2 months ago

hi sir,

 

it  remains time being i have removed on load option.

 

 

Thanks

Abu Ghufran Staff answered 2 months ago

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

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

10 + 11 =

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?