seelct2

Questionsseelct2
germanmary asked 9 years ago

hi sir,

i have used Select 2 option for the drop downs.
it works well but i am facing a small issue?
i have tried to solve it but i could not.
1.Selected bank and branch is loaded accordingly
i search for a branch
and again changed the bank
the searched branch is not getting cleard.

Please help me to reset

this very emergency

this is my code

$col = array();
$col["title"] = "BANK NAME"; // caption of column
$col["name"] = "bankid";
$col["dbname"] = "bankid";
$col["width"] = "40"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col["editable"] = true;
$col["width"] = "200";
$col["align"] = "left";
$col["search"] = true;
$col["editable"] = true;
$col["isnum"] = true;
$col["isnull"] = true;
$col["edittype"] = "select"; // render as select
# fetch data from database, with alias k for key, v for value
$banktb='"hrms_bankmast"';
$bankid='"bankid"';
$bankname='"bankname"';
$branchtb='"hrms_branchmast"';
$branchid='"branchid"';
$branchname='"branchname"';
$str = $grid->get_dropdown_values("select $bankid as k, $bankname as v from ADMIN.$banktb ");
$col["editoptions"] = array(
"value"=>":;".$str,
"onchange" => array("sql"=>"select distinct $branchid as k, $branchname as v from ADMIN.$branchtb WHERE $bankid = '{bankid}'",
// "search_on"=>$branchid,
// "callback" => "update_bank"
"update_field" =>"branchid"
)
);
$col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_bank('{$col["name"]}'); },550); }";

$col["formatter"] = "select";
$col["stype"] = "select";
$col["searchoptions"] = array("value" => ":;".$str);
$col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_bank('gs_{$col["name"]}'); },550); }";
$col["formoptions"] = array("rowpos"=>"11", "colpos"=>"1") ;
$col["show"] = array("list"=>false,"edit"=>true,"add"=>true);
$cols[] = $col;

$col = array();
$col["title"] = "BRANCH NAME"; // caption of column
$col["name"] = "branchid";
$col["dbname"] = 'ADMIN.hrms_branchmast.branchid';
$col["width"] = "40"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col["align"] = "left";
$col["search"] = true;
$col["editable"] = true;
$branchtb='"hrms_branchmast"';
$branchid='"branchid"';
$branchname='"branchname"';
$bankid='"bankid"';
$banktb='"hrms_bankmast"';
$bankid='"bankid"';
$bankname='"bankname"';
$col["isnum"] = true;
$col["isnull"] = true;
$col["edittype"] = "select"; // render as select

$str = $grid->get_dropdown_values("select distinct $branchid as k, $branchname as v from ADMIN.$branchtb
inner join ADMIN.$banktb on ADMIN.$banktb.$bankid= ADMIN.$branchtb.$bankid ");
/* } */
$col["editoptions"] = array(
"value"=>":;".$str,
"onchange" => array("sql"=>"select * from ADMIN.$branchtb WHERE $branchid = '{branchid}'",

"callback" => "update_fieldsbr"));
$col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_branch('{$col["name"]}'); },550); }";
$col["formatter"] = "select";
$col["stype"] = "select";
$col["searchoptions"] = array("value" => ":;".$str);
$col["searchoptions"]["dataInit"] = "function(){ setTimeout(function(){ link_branch('gs_{$col["name"]}'); },550); }";
$col["hidden"] = true;
$col["formoptions"] = array("rowpos"=>"11", "colpos"=>"2")

1 Answers
Abu Ghufran answered 9 years ago

Emailing you an update

Your Answer

20 + 14 =

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?