Ok, this is my source code. The window never appears before the request
starts. At first I call the initReq function and then the getTopMenuItems
function. 



qx.Class.define("myApp.classes.dao.TopMenuItemDao",
{
  extend: qx.core.Object,
  
  properties: {
    req: { init: null, check: "qx.io.request.Xhr" },
    reqData: { init: null, check: "object" },
    win: { init: null, check: "qx.ui.window.Window" },
    surface: { init: null, check: "qx.ui.container.Composite" }
  },
  
  construct: function(surface){
    this.base(arguments);    
    this.setSurface(surface);
  },

  members :
  {      
    initReq: function(url, method){
      this.setReq(new qx.io.request.Xhr(url, method));
      this.getReq().setAsync(false);
      
      this.getReq().addListener("load", function(e){
        //alert("load");        
      }, this);
            
      this.getReq().addListener("readyStateChange", function(e){
        //alert("readyStateChange");
      }, this);
      
      this.getReq().addListener("statusError", function(e){
        alert("statusError");
      }, this);
      
      this.getReq().addListener("success", function(e){
        //alert("success");
        var result = e.getTarget();
        this.setReqData(result.getResponse());
        this.getWin().destroy();
      }, this);      
    },
            
    getTopMenuItems: function(){   
      //alert(document.URL.split(":")[0] + "://" + location.host +
"/myApp/php/functions.php");   
      this.initReq(document.URL.split(":")[0] + "://" + location.host +
"/myApp/php/functions.php", "GET");
      this.getReq().setRequestData({"function": "getTopMenuItems"});  
      
      this.getWin() = new qx.ui.window.Window("loading").set({width: 250,
height: 150});
      this.getSurface().add(this.getWin());
      this.getWin().open();

      this.getWin().addListener("appear", function(){
        this.getReq().send();        
      }, this);
    }
    
  }
});





--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Show-window-before-sending-a-request-tp7290524p7293802.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to