Hello,
I have a grid with 2 combo fields (coro). Both loading data from a mySQL database. The main table is a article table which has a articlegroupId. The description of the articlegroepId is stored in the table articlegroup. Now I need a second level (articlesubgroup). Therefore I have a separate table articlesubgroup where the subgroupId’s are stored per articlegroup.
When loading the data I get the correct subgroup. Now when I add a row or edit a row I want in the select list of the articlesubgroup only the values corresponding with the articlegroup.
How do I do this?
hereby the code I’m using currently
The grid code:
// define myGrid
myGrid.setHeader("ArtikelNr,Naam,Omschrijving,Groep,SubGroep,Min Voorraad,Min Bestel Aantal,Locatie,Barcode,Leverancier,Inkoop Prijs,Verkoop Prijs,Eenheid,Favorieten Lijst");
myGrid.setColumnIds("ArtikelNr,Naam,Omschrijving,[b]GroepId,SubGroepId[/b],MinVoorraad,MinBestelAantal,LocatieId,Barcode,LeveranciersNr,InkoopPrijs,VerkoopPrijs,EenheidId,FavorietenLijst");
myGrid.setColValidators(["NotEmpty",null,null,null,null,null,null,null,null,null,null,null,null,null]);
myGrid.setInitWidths("90,150,200,100,100,70,70,90,100,150,70,70,90,80");
myGrid.setColAlign("left,left,left,left,left,left,left,left,left,left,left,left,left,center");
myGrid.setColTypes("ed,ed,txt,coro,coro,edn,edn,coro,ed,coro,price,price,coro,ch");
myGrid.setColSorting("str,str,str,str,str,str,str,str,str,str,str,str,str,str,str");
myGrid.setNumberFormat("0,000",4,",",".");
myGrid.setNumberFormat("0,000",5,",",".");
myGrid.enableAutoHeight(true,780,false);
eXcell_price.prototype.setValue = function(val){
if(isNaN(Number(val))){val = 0;}
this.setCValue("<span>€</span><span style='padding-right:2px;padding-left:3px;'>"+val+"</span>",val);
};
myGrid.init();
myGrid.load("classes/dhtmlx/data/artikelLoad.php");
the dataprocessor looks like this:
$grid = new GridConnector($mysqli,"MySQLi");
[b] $artikelgroep = new OptionsConnector($mysqli,“MySQLi”);
$artikelgroep->render_table(“tbl_artikelgroep”,“GroepId”,“GroepId(value),Omschrijving(label)”);
$grid->set_options(“GroepId”,$artikelgroep);
$artikelsubgroep = new OptionsConnector($mysqli,"MySQLi");
$artikelsubgroep->render_table("tbl_artikelsubgroep","SubGroepId","SubGroepId(value),SubGroep(label)");
$grid->set_options("SubGroepId",$artikelsubgroep);[/b]
$locatie = new OptionsConnector($mysqli,"MySQLi");
$locatie->render_table("tbl_locatie","LocatieId","LocatieId(value),LocatieId(label)");
$grid->set_options("LocatieId",$locatie);
$leverancier = new OptionsConnector($mysqli,"MySQLi");
$leverancier->render_table("tbl_leverancier","LeveranciersNr","LeveranciersNr(value),Naam(label)");
$grid->set_options("LeveranciersNr",$leverancier);
$eenheid = new OptionsConnector($mysqli,"MySQLi");
$eenheid->render_table("tbl_eenheid","EenheidId","EenheidId(value),Eenheid(label)");
$grid->set_options("EenheidId",$eenheid);
$grid->render_table("tbl_artikel","ArtikelId","ArtikelNr,Naam,Omschrijving,[b]GroepId,SubGroepId[/b],MinVoorraad,MinBestelAantal,LocatieId,Barcode,LeveranciersNr,InkoopPrijs,VerkoopPrijs,EenheidId,FavorietenLijst");