Jump to content

waterinfo

Members
  • Posts

    24
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by waterinfo

  1. Where and how it is declared?

     

    Thanks for Farshad for so instant replay.

     

    in fact,all i want to do is declared as the title: How we do a sql query in a java script

     

     

    at first,I defined a UniMainModule.DoQuery procedure as bellow:

    procedure TUniMainModule.DoQuery(sSQL:string;aDataSet:TDataSet=nil;sLog:string='');
    begin
     if aDataSet=nil then
        aDataSet:=qySuper;
     //todo:Only think TADOQuery now.
     with aDataSet as TADOQuery do
       begin
         Close;
         SQL.Text:=sSQL;
         Open;
         //todo Save Log
       end;
    end;
    

     

    In UI, I defined a click event in pascal,It works fine:

    procedure TMainForm.UniBitBtn2Click(Sender: TObject);
    begin
       DoQuery(UniEdit1.Text);
    end;
    

     

    All I want to do is call it from JS,so I defined a simple extEvents click as below .

     

    function OnClick(sender, e)
    {
     alert( MainForm.UniEdit1.getValue( )+'asdf');            //fine
     UniMainModule.DoQuery( MainForm.UniEdit1.getValue( ));   //fail, Here is the question : I debug and and find it not work at all!
     alert(  MainForm.UniEdit1.getValue( ));                  //fail
    }
    

     

    I guess the reason is the DoQuery has be rename to some thing else,since i debug in the html's source code and find no that declaration named DoQuery at all!

     

    So my question may be simplified as "HOW TO CALL A DELPHI'S PROCEDURE FROM JS"

     

    Thanks for Farshad's help again!

  2. Actually it HAS to do with this topic since you are trying to pass it's content to UniGui app via ajaxRequest, and because you can't perform queries directly in javascript.

    So I repeat my question - what does SQL property contain?

     

     

    SQL property is just a node of ztree's property defined by myself.

  3. Where do you handle ajax calls on server side?

     

    Thanks for both of your's instant response.

     

    I was build a tree inherited by ztree on client side.the .SQL property was i extend by ztree's node,have nothing to do with this topic.

     

    what I want to do was when user click some of the node, we should take some action and fetch data from server to show in a dbgrid.

     

    the code show on the top was that, I have just test two different way,on call a query directly in javas cript and anther is test for using a ajax action define response in unguiHTMLFrame ajax handle event. but none of them success yet.

  4. Dear zilav,thank for u excellent suggestion!

     

    But's still make me fuse when many google's demo script can by load by my program,can u give me any more suggestion like this:

     

     

     

     

    <!--
    You are free to copy and use this sample in accordance with the terms of the
    Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
    -->
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
       <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
       <title>
         Google Visualization API Sample
       </title>
       <script type="text/javascript" src="http://www.google.com/jsapi"></script>
       <script type="text/javascript">
         google.load('visualization', '1', {packages: ['gauge']});
       </script>
       <script type="text/javascript">
         function drawVisualization() {
           // Create and populate the data table.
           var data = new google.visualization.DataTable();
           data.addColumn('string', 'Label');
           data.addColumn('number', 'Value');
           data.addRows(3);
           data.setValue(0, 0, 'Memory');
           data.setValue(0, 1, 80);
           data.setValue(1, 0, 'CPU');
           data.setValue(1, 1, 55);
           data.setValue(2, 0, 'Network');
           data.setValue(2, 1, 68);
         
           // Create and draw the visualization.
           new google.visualization.Gauge(document.getElementById('visualization')).
               draw(data);
         }
         
    
         google.setOnLoadCallback(drawVisualization);
       </script>
     </head>
     <body style="font-family: Arial;border: 0 none;">
       <div id="visualization" style="width: 600px; height: 300px;"></div>
     </body>
    </html>
    

  5. I was using a unihtmlFrame,which hold a jquery tree.

     

    Now ,I want to do some query after user click some node, The question is as the title.

     

    source code:

     

         function onClick(event, treeId, treeNode) {
            if (treeNode.level == 1 )
            {
       
             MainForm.UniEdit1.setValue(treeNode.SQL);   //can be see
    
             MainForm.DoQuery(treeNode.SQL);
            
             
            ajaxRequest(MainForm.UniHTMLFrame1,
               'Click',
               ['sql='+treeNode.SQL]);
            }
          }
        
          
      

     

    at present ,none of the direct call or the ajax call can be execute.

     

    Thanks for any help or suggestion!

  6. First of all. Please enclose your code in [ code ] tag so your posts will be more readable.

     

    You can analyze our Google Maps demo and make necessary changes and adopt it to Google earth.

     

    Farshad,Thanks for you instant replay,I was just analysis your excellent demo about Google map,But about google Earth,Every thing was changed.

     

    I find this line was wrong or without properly result:

     

    google.load('earth','1');

     

    I has taken all day long to solve this problem ,but no answer yet:(

  7. I would like to show the detail code generated by unigu , cound any one experienced with extjs can tell me the reason.

     

    Since there is always a loading.. show in the page.

     

     

     

    -----------------------------------------------------

     

    
    <!DOCTYPE html public>
    
    <html>
    
    <head>
    
    <title>New Application</title>
    
    <meta http-equiv="content-type" content="charset=utf-8" />
    
    <meta http-equiv="cache-control" content="no-cache" />
    
    <meta http-equiv="pragma" content="no-cache" />
    
    
    
    <link rel=stylesheet href="ext-3.4.0/resources/css/uni-ext.css" />
    
    <link rel=stylesheet href="ext-3.4.0/resources/css/ext-all.css" />
    
    <script src="ext-3.4.0/adapter/ext/ext-base.js"></script>
    
    <script src="ext-3.4.0/ext-sync-1.3.7-min.js"></script>
    
    <script src="ext-3.4.0/ext-all.js"></script>
    
    <script src="ext-3.4.0/examples/ux/ux-all.js"></script>
    
    <link rel=stylesheet href="ext-3.4.0/resources/css/xtheme-blue.css" />
    
    <link rel=stylesheet href="ext-3.4.0/examples/ux/css/ux-all.css" />
    
    <link rel=stylesheet href="ext-3.4.0/resources/css/uni-xtheme-blue.css" />
    
    <script src="http://www.google.com/jsapi?key=ABQIAAAAtnKGgF_rljT3MDHOFHbWKhRi_j0U6kJrkFvY4-OX2XYmEAa76BQVsSWfv5Fi27cTJJ8aXqbIR2Vngg"></script>
    
    <script src="ext-3.4.0/ext-unigui-1.3.7-min.js"></script>
    
    
    
    </head>
    
    <p></p>
    
    <script>
    
    _S_ID="_S_ID=HyIkLgG6qq1P9VS";
    
    Ext.onReady(function()
    {setTimeout(function()
    {Ext.get("loading").remove();
    Ext.get("loading-mask").fadeOut({remove:true});},250);
    Ext.BLANK_IMAGE_URL="ext-3.4.0/resources/images/default/s.gif";
    
    TextMetrics=Ext.util.TextMetrics.createInstance(Ext.getBody());
    
    function AjaxError(m, t){Ext.Msg.show({title:"Ajax Error",multiline: true,value:t,width:400,minWidth:200,msg:m,icon:Ext.Msg.ERROR,buttons:Ext.Msg.OK});};
    function AjaxSuccess(response){if(_aexc_(response))return;try{eval(response.responseText);}
    catch(err){AjaxError(err.message,response.responseText);}};
    function AjaxFailure(){AjaxError("Server unavailable, please try later");};
    Download=Ext.DomHelper.append(document.body,{tag:"iframe",cls:"x-hidden"}); 
    
    O0=new Ext.Window({id:"O0_id",retfalse:{},title:"MainForm",width:600,height:579});O0.nm="O0";
    _cdo_("MainForm");MainForm.ajxS=AjaxSuccess;MainForm.ajxF=AjaxFailure;O0.rootObj=true;MainForm.appRoot="/";
    _cdo_(null,O0,"window",MainForm);
    O10=new Ext.form.FormPanel({id:"O10_id",border:false,layout:"absolute",anchor:"100% 100%",tabItems:new Ext.util.MixedCollection()});O10.nm="O10";_cdo_(null,O10,"form",MainForm);
    O10.on("afterrender",function(P0){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O10&Evt=afterrender&This="+P0.nm+""+"&ci="+_gci_()+_gv_(O10),success:AjaxSuccess,failure:AjaxFailure,obj:O10,e:"afterrender"});});
    O20=new Ext.Panel({id:"O20_id",layout:"absolute",bodyBorder:false,border:false,width:553,height:457,x:16,y:105});
    O20.nm="O20";
    
    _cdo_("UniHTMLFrame1",O20,null,MainForm);
    _coe_(MainForm,"UniHTMLFrame1",null,"afterupdatehtml",
    function(sender) {      
    var ge;       
    google.load("earth", "1");     
      function init() {          google.earth.createInstance('map3d', initCB, failureCB);       }       
      function initCB(instance) {          
      ge = instance;          
      ge.getWindow().setVisibility(true);       }      
      function failureCB(errorCode) {       }        
      google.setOnLoadCallback(init);  });
    O10.add(O20); 
    
    O2F=new Ext.Button({id:"O2F_id",text:"UniBitBtn1",width:75,height:25,x:96,y:-56,scale:"small",icon:""});
    O2F.nm="O2F";_cdo_("UniBitBtn1",O2F,null,MainForm);O20.add(O2F); 
    O33=new Ext.Button({id:"O33_id",text:"UniBitBtn2",width:75,height:25,x:72,y:-48,scale:"small",icon:""});O33.nm="O33";
    _cdo_("UniBitBtn2",O33,null,MainForm);O20.add(O33); 
    O37=new Ext.Button({id:"O37_id",text:"UniBitBtn3",width:105,height:33,x:32,y:50,scale:"medium",icon:""});O37.nm="O37";
    _cdo_("UniBitBtn3",O37,null,MainForm);O10.add(O37);O10.render(document.body);
    O3B=new Ext.Viewport({id:"O3B_id"});O3B.nm="O3B";
    O3B.on("resize",function(P0,P1,P2,P3,P4){return Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=1&IsEvent=1&Obj=O3B&Evt=resize&This="+P0.nm+"&AdjWidth="+P1+"&AdjHeight="+P2+"&RawWidth="+P3+"&RawHeight="+P4+""+"&ww="+P0.getWidth()+"&hh="+P0.getHeight()+_gv_(O10),success:AjaxSuccess,failure:AjaxFailure,obj:O3B,e:"resize"});});_cwk_();_dko_({BS:true,ESC:true});
    O20.update(" <div id=\"map3d\" style=\"height: 457px; width: 600px;\"></div>\n \n", true);
    O20.fireEvent("afterupdatehtml", this);});
    
    </script>
    
    <body>
    
    <div id="loading-mask"></div><div id="loading">
    
    <div class="loading-indicator">Loading...</div></div>
    
    <div id=body></div><noscript>This web application requires JavaScript enabled</noscript></body>
    
    <link REL="SHORTCUT ICON" HREF="cache/openGPS/HyIkLgG6qq1P9VS/favicon.ico"></html>
    
    

  8. as the title ,not like google map.

     

    as the bellow,the key is sign by 127.0.0.1

     

    I found the UniGUI was failed at the first line : google.load("earth", "1");

     

    Any suggestion will be appreciated!

     

    <html>
    
    <head>
    
      <title>Sample</title>
    
      <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAtnKGgF_rljT3MDHOFHbWKhRi_j0U6kJrkFvY4-OX2XYmEAa76BQVsSWfv5Fi27cTJJ8aXqbIR2Vngg"> </script>
    
      <script type="text/javascript">
    
         var ge;
    
         google.load("earth", "1");
    
    
    
         function init() {
    
            google.earth.createInstance('map3d', initCB, failureCB);
    
         }
    
    
    
         function initCB(instance) {
    
            ge = instance;
    
            ge.getWindow().setVisibility(true);
    
         }
    
    
    
         function failureCB(errorCode) {
    
         }
    
    
    
         google.setOnLoadCallback(init);
    
      </script>
    
    
    
    </head>
    
    <body>
    
      <div id="map3d" style="height: 400px; width: 600px;"></div>
    
    </body>
    
    </html>
    
    

×
×
  • Create New...