Strange behaviour when load data in a form

Here’s my problem.
I have a layout with a grid.
When I double click on a row, I show a form and I load all the data of the record selected in the grid.
Sometimes, data are loaded and sometimes they are not !!!

Here’s my piece of code.
The grid part :

            fluxGrid.attachEvent("onRowDblClicked", doOnRowDblClicked);

The form part :

function doOnRowDblClicked(rowId){
	dhxWins = new dhtmlXWindows();
	detailWin = dhxWins.createWindow("detailWin", 80, 80, 800, 600);
        detailWin.setText("Fiche détaillée du flux n° " + rowId);;
        detailForm = detailWin.attachForm();        
        detailForm.attachEvent("onButtonClick", function(name) {
                switch(name) {
                    case "pbCancel" :
                    case "pbOK" :
                    default :
        detailForm.load("php/loadflux.php?id=" + rowId);
        dp = new dataProcessor("php/loadflux.php");

In the form I have many combo loaded form tables
Here is the php part :


<?php require("../codebase/form_connector.php"); $res=mysql_connect("localhost","root","********"); mysql_select_db("gestflux"); $form = new FormConnector($res,"MySQL"); $form->enable_log("/var/www/gestflux/php/log_loadflux.txt"); $form->render_table("flux_actif", "id_flux", "id_flux,nom,objet,client,projet,moteur,script_dex,id_appli_source,id_appli_cible,transport,method_get,method_put, id_srv_source,id_srv_cible,format_source,format_cible,id_frequence,is_mapping,script_dex, date_cible_debut_migration,date_cible_fin_migration,date_reelle_debut_migration,date_reelle_fin_migration, charge,intervenant"); ?>[/code]

Here’s the json file to create the form :

{type: “settings”, position: “absolute”, labelWidth: 100, inputWidth: 150},

{ type:"input", name:"id_flux", label:"Identifiant du Flux", labelAlign:"right", inputWidth:80, labelLeft:40, labelTop:25, inputLeft:160, inputTop:20 },
{ type:"input", name:"nom", label:"Nom du Flux", labelAlign:"right", inputWidth:300, labelLeft:320, labelTop:25, inputLeft:440, inputTop:20 }, 
{ type:"input", name:"projet", label:"Projet", labelAlign:"right", inputWidth:180, labelLeft:40, labelTop:60, inputLeft:160, inputTop:55 },
{ type:"input", name:"objet", label:"Objet du Flux", labelAlign:"right", inputWidth:580, labelLeft:40, labelTop:95, inputLeft:160, inputTop:90 },
{ type:"combo", name:"client", label:"Client", labelAlign:"right", inputWidth:180, labelLeft:40, labelTop:127, inputLeft:160, inputTop:125, filtering: true, connector: "php/getclient.php", value: "" },
{ type:"combo", name:"moteur", label:"Moteur", labelAlign:"right", inputWidth:180, labelLeft:440, labelTop:127, inputLeft:560, inputTop:125, filtering: true, connector: "php/getmoteur.php", value: "" },
{ type:"combo", name:"id_appli_source", label:"Appli source", labelAlign:"right", inputWidth:180, labelLeft:40, labelTop:165, inputLeft:160, inputTop:160, filtering: true, connector: "php/getappli.php", value: "" },
{ type:"combo", name:"id_appli_cible", label:"Appli Cible", labelAlign:"right", inputWidth:180, labelLeft:440, labelTop:165, inputLeft:560, inputTop:160, filtering: true, connector: "php/getappli.php", value: "" },
{ type:"combo", name:"id_srv_source", label:"Serveur Source", labelAlign:"right", inputWidth:180, labelLeft:40, labelTop:200, inputLeft:160, inputTop:195, filtering: true, connector: "php/getserveur.php", value: "" },
{ type:"combo", name:"id_srv_cible", label:"Serveur Cible", labelAlign:"right", inputWidth:180, labelLeft:440, labelTop:200, inputLeft:560, inputTop:195, filtering: true, connector: "php/getserveur.php", value: "" },
{type:"input", name:"script_dex", label:"Scrip Original", labelAlign:"right", inputWidth:580, labelLeft:40, labelTop:235, inputLeft:160, inputTop:230 },
{ type:"combo", name:"id_frequence", label:"Fréquence", labelAlign:"right", inputWidth:580, labelLeft:40, labelTop:270, inputLeft:160, inputTop:265, filtering: true, connector: "php/getfrequence.php", value: ""  },
{ type:"combo", name:"transport", label:"Mode Transport", labelAlign:"right", inputWidth:180, labelLeft:40, labelTop:305, inputLeft:160, inputTop:300, filtering: true, connector: "php/gettransport.php", value: "" },
{ type:"combo", name:"method_get", label:"Méthode Récupération", labelAlign:"right", labelWidth:125, inputWidth:180, labelLeft:16, labelTop:340, inputLeft:160, inputTop:335 },
{ type:"combo", name:"method_put", label:"Méthode Chargement", labelAlign:"right", labelWidth:125, inputWidth:180, labelLeft:415, labelTop:340, inputLeft:560, inputTop:335 },    
{ type:"checkbox", name:"is_mapping", label:"Mapping (O/N)", labelWidth:95, labelAlign:"right", labelLeft:40, labelTop:375, inputLeft:160, inputTop:370 },
{ type:"combo", name:"format_source", label:"Format Source", labelAlign:"right", inputWidth:180, labelLeft:40, labelTop:410, inputLeft:160, inputTop:405, filtering: true, connector: "php/getformat.php", value: "" },
{ type:"combo", name:"format_cible", label:"Format Cible", labelAlign:"right", inputWidth:180, labelLeft:440, labelTop:410, inputLeft:560, inputTop:405, filtering: true, connector: "php/getformat.php", value: "" },

{ type:"calendar", name:"date_cible_debut_migration", label:"Début Cible Migration", labelAlign:"right", labelWidth:122, inputWidth:180, labelLeft:19, labelTop:445, inputLeft:160, inputTop:440, minutesInterval:5 },
{ type:"calendar", name:"date_cible_fin_migration", label:"Fin Cible Migration", labelAlign:"right", inputWidth:180, labelLeft:445, labelTop:445, inputLeft:560, inputTop:440 },

{type:"button", name:"pbOK", value:"Valider", inputLeft:280, inputTop:500},
{type:"button", name:"pbCancel", value:"Annuler", inputLeft:430, inputTop:500}


If somebody can help me, it will be great.
By the way I have a second question :
When fortunately, my form is loaded, I can change some data and save. It’s well recorded in the table, but how can I refresh the grid ?

Thanks for you help.


To complete my information :
This problem arrives under chrome v52.0.2743 and Edge v25.10586 but not under firefox v47.020.187.



You have two async load command

detailForm.loadStruct("json/formflux.json"); detailForm.load("php/loadflux.php?id=" + rowId);

It is possible that response for loadflux.php comes before formflux.php, so form loads data first and config after that, which result in empty form.
Try to change code like next

detailForm.loadStruct("json/formflux.json", function(){ detailForm.load("php/loadflux.php?id=" + rowId); });

Thanks a lot Stanislav,

It’s work perfectly.