Abhu Im having trouble with dropdown dependent using select2, When im adding a record works fine for example
if column1 is = to id 1 then column 2 shows records according to value on column1 but if i go edit mode column2 shows all records in table, besides in edit mode if i change value on column1 value on column2 is not resseting until i click on column2
code sample
$col=array();
$col[“formatter”]=”select”;
$col[“title”]=”Family”;
$col[“hidden”]=false;
$col[“name”]=”idFamilia”;
$col[“width”]=”5″;
$col[“editable”]=true;
$col[“align”]=”center”;
$col[“search”]=true;
$client_lookup=$g->get_dropdown_values(“select distinct id as k, numeroFamilia as v from calibra2.calibracion_familias ORDER by numeroFamilia”);
$col[“stype”]=”select”;
$str=”:;”.$client_lookup;
$col[“searchoptions”]=array(“value”=>$str,”separator”=>”:”,”delimiter”=>”;”);
$col[“edittype”]=”select”;
$col[“editoptions”]=array(“value”=>$client_lookup);
$col[“editoptions”]=array(
“value”=>$str,
“onchange”=>array( “sql”=>”select distinct id as k, nombreSubfamilia as v from calibra2.calibracion_subfamilias WHERE idFamilia = ‘{idFamilia}'”,
“update_field”=>”idSubfamilia”)
);
$col[“searchoptions”][“dataInit”]=”function(){ setTimeout(function(){ $(‘select[name=idFamilia]’).select2({width:’80%’, dropdownCssClass: ‘ui-widget ui-jqdialog’}); },200); }”;
$col[“editoptions”][“dataInit”]=”function(){ setTimeout(function(){ $(‘select[name=idFamilia]’).select2({width:’80%’, dropdownCssClass: ‘ui-widget ui-jqdialog’}); },200); }”;
$col[“dbname”]=”ins.idFamilia”;
$cols[]=$col;
$col=array();
$col[“formatter”]=”select”;
$col[“title”]=”Subfamily”;
$col[“hidden”]=false;
$col[“name”]=”idSubfamilia”;
$col[“width”]=”8″;
$col[“editable”]=true;
$col[“align”]=”center”;
$col[“search”]=true;
$client_lookup=$g->get_dropdown_values(“select distinct id as k, nombreSubfamilia as v from calibra2.calibracion_subfamilias ORDER by nombreSubfamilia”);
$col[“stype”]=”select”;
$str=”:;”.$client_lookup;
$col[“searchoptions”]=array(“value”=>$str,”separator”=>”:”,”delimiter”=>”;”);
$col[“edittype”]=”select”;
$col[“editoptions”]=array(“value”=>$client_lookup);
$col[“searchoptions”][“dataInit”]=”function(){ setTimeout(function(){ $(‘select[name=idSubfamilia]’).select2({width:’80%’, dropdownCssClass: ‘ui-widget ui-jqdialog’}); },200); }”;
$col[“editoptions”][“dataInit”]=”function(){ setTimeout(function(){ $(‘select[name=idSubfamilia]’).select2({width:’80%’, dropdownCssClass: ‘ui-widget ui-jqdialog’}); },200); }”;
$col[“dbname”]=”ins.idSubfamilia”;
$cols[]=$col;
EDIT:
Even on edit or insert mode column 2 shows all records, to see filtered records based on column 1 i have to click column 2 I need that everytime i change value on record1 column2 resets and show records according to value in record1 no matter if im on edit or insert mode
Hello,
If this issue still exist, please share screen-cast showing this issue.
You can use screencastify.com
PS: Apologies for the delay. Due to limited work schedule, we are focused in giving technical support to active licensed customers only. If you already have license, please let us know your payment email OR order number so we can update our records.