1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    21
    Vote Rating
    0
    francesca1081 is on a distinguished road

      0  

    Default autoLoad panel

    autoLoad panel


    Hi. I'd like to load a simple html page inside a Panel so I tried to use the property autoLoad but it doesn't work, I have no one error but nothing happen !

    This is my js file:
    Code:
    Ext.onReady(function(){
    var button = Ext.get('show-btn');
    button.on('click', function(){
     
    var menu=new Ext.Panel({
    id:'menu',
    region:'center',
    
    autoLoad: {
    url: 'info.html', 
    scripts: false,
    text:'Loading...'
    }
    });
     
    var win = new Ext.Window({
    id:'finestra-menu',
    title: 'Menu principale',
    region:'center',
    closable:true,
    collapsible:true,
    width:180,
    height:350,
    x:1095,
    y:33,
    draggable:false,
    plain:true,
    layout: 'border',
    items:[menu]
    });
    win.show(this); 
    });
    });
    My html file is very simple because for the moment I only want to understand how can I load a html file inside a panel:

    HTML Code:
    <html>
    <head>
    <title>Vercelli Book</title>
     
    <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
    <link rel="stylesheet" type="text/css" href="stile/layout.css" />
    <link rel="stylesheet" type="text/css" href="stile/zoom.css" />
     
    [code]
    <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="../../ext-all.js"></script>
    <script type="text/javascript" src="js/layout.js"></script>
    <script type="text/javascript" src="js/navigazione.js"></script>
    <script type="text/javascript" src="js/funzioni.js"></script>
    [/code]
     
    </head>
    <body>
    <p>ciao siamo le info</p>
    </body>
    </html>

    Please..... HELP ME!!!
    Bye, Francesca

  2. #2
    Ext User
    Join Date
    Sep 2007
    Posts
    66
    Vote Rating
    0
    thaiat is on a distinguished road

      0  

    Default


    try get rid of the css and script references in info.html, this should work fine...

  3. #3
    Ext User
    Join Date
    Jul 2008
    Posts
    21
    Vote Rating
    0
    francesca1081 is on a distinguished road

      0  

    Default


    Sorry, but I'm just at the beggining with this kind of project so can you write me an example please?
    Thanks!

  4. #4
    Ext User
    Join Date
    Sep 2007
    Posts
    66
    Vote Rating
    0
    thaiat is on a distinguished road

      0  

    Default


    replace the content of your info.html by

    PHP Code:
    <html>
    <
    head>
    <
    title>Vercelli Book</title>
    </
    head>
    <
    body>
    <
    p>ciao siamo le info</p>
    </
    body>
    </
    html
    if this is not working try to see in firebug if you are getting the content for that file

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    What is loaded is an HTML fragment, not a page. The <html>, <head>, <body> etc tags will be ignored because what happens is that it just gets put into innerHTML.

    So just send

    Code:
    <p>ciao siamo le info</p>
    If you really want to include scripts, then include those scripts in the <head> of the main page. Do not include them later (And possibly multiple times) through Ajax, load them once at page load.

  6. #6
    Ext User
    Join Date
    Jul 2008
    Posts
    21
    Vote Rating
    0
    francesca1081 is on a distinguished road

      0  

    Default


    I try to explain better my situation because even if I replaced my html code autoLoad is not doing well. So, I have a main page with some buttons. When I click on one of these, I open a window where I want to load the html page that you saw.
    I have:
    a main page that contains the button
    the window opened by this button (file js contains the function to do this)
    the html file that must be viewed inside the window

    When I load tha main page and I click on my button I don't have any error by firebug... why?

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Why not just autoLoad the Window rather than adding a Panel to the Window and autoLoading the Panel?

  8. #8
    Ext User
    Join Date
    Jul 2008
    Posts
    21
    Vote Rating
    0
    francesca1081 is on a distinguished road

      0  

    Default


    Ok, I did everything you told me but it doesn't well... so this is my html page

    HTML Code:
    <p>ciao siamo le info</p> 
    and this is my js page

    Code:
    Ext.onReady(function(){
        var button = Ext.get('show-btn');
      button.on('click', function(){
     
     
     
            var win = new Ext.Window({
          id:'finestra-menu',
                title: 'Menu principale',
          region:'center',
                closable:true,
          collapsible:true,
                width:180,
                height:350,
                x:1095,
          y:33,
          draggable:false,
                plain:true,
          autoLoad: {
                      url: 'info.html', 
                      scripts: false,
             text:'Loading...'
                      }
            });
            win.show(this);
     
     
        });
     
     
    });
    Where is the problem?

  9. #9
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    52
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    What's the problem? Have you checked the window's DOM using Firebug? Have you checked the XHR content and status using Firebug? Basically, have you been a professional developer and degbugged?

  10. #10
    Ext User
    Join Date
    Jul 2008
    Posts
    21
    Vote Rating
    0
    francesca1081 is on a distinguished road

      0  

    Default


    I'm sorry that you can't help me... I used firebug but I don't have any kind of experience so it's very hard for me to understand where's the problem... I'm not a professional developer and maybe THIS is the problem!
    However thanks for your help

Thread Participants: 2