Results 1 to 10 of 10

Thread: Layout in a Panel, built by Url Target

  1. #1

    Default Layout in a Panel, built by Url Target

    I'm working on a small application in which I have displays loading into panels in the center region, using the URL attribute. I'd like to have these panels establish their own layouts... what would the best route be? Can I put the JS needed in the page being loaded, or do I have to build this into the module on the containing page?

    Thanks,
    Jon

  2. #2
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    If you can get to 2.0, this or this are steps in the right direction.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  3. #3

    Default

    Unfortunately, I'm limited to 1.1.1 for this project. Is there something I can do along those lines without 2.0?

  4. #4
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    Indeed, that's what many do on the 1.1 release. Load the panel from a URL with a script tag in the response, and go nuts.

    2.0 is setup to handle this much easier tho.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  5. #5

    Default

    hendricd,

    You're saying that the accepted method for 1.1.1 is to include the code in the response page... I'm trying to do that and it doesn't seem like the JS is doing anything.

    Code:
    <html>
    	<head>
    		<title></title>
    	</head>
    	<body>
    	<script>
    		alert('ding ding');
    	</script>
    	hello!
    	</body>
    </html>
    As the response loads the hello message, but does not display an alert.

    I'm using the following code to load the content:

    Code:
    layout.add('center', new Ext.ContentPanel(thisID, {
    	title: accountID,
    	autoCreate: true,
    	closable: true,
    	url: 'pages/account.cfm',
    	params: {
    		accountID: accountID
    	},
    	scripts: true,
    	loadOnce: true,
    	fitToFrame: true
    }));
    Am I doing something wrong when I add the tab?

  6. #6
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    Do Not load any entire page into the panel! Send a fragment of static markup(if even necessary) and a script tag.

    HTML Code:
    <script>
            alert('ding ding');
        </script>
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  7. #7

    Default

    HTML Code:
    <div>Hi</div>
    <script>alert('ding');</script>
    Sent through the panel displays "hi", but still no ding. That had been my original test, but I added the <html>... markup to see if that made a difference...

    Sorry to turn this into an implementation problem thread vs a concept thread, heh.

  8. #8
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    loadScripts:true ?

    PS: Never, ever, add an <HTML> tag to a server response that will end up inside one of your DIV's.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  9. #9

    Default

    Yeah, I know <html> inside stuff is mondo bad, I was just attempting to see if the presence of the tag would cause the script to execute... I fancy myself proficient at JS, but I'm not 100% on quirks of execution and such.

    I found the solution finally... you can't pass the loadScripts in to the content panel constructor, as far as I can tell. I had to do this:

    Code:
    layout.beginUpdate();
    var panel = layout.add('center', new Ext.ContentPanel(thisID, {
    	title: accountID,
    	autoCreate: true,
    	closable: true,
    	loadOnce: true,
    	fitToFrame: true
    }));
    layout.endUpdate();
    
    panel.getUpdateManager().loadScripts = true;
    panel.setUrl('pages/viewAccount.cfm', {
    	accountID: accountID
    });
    panel.refresh();
    In order to get it to work.

    Thank you for the suggestions and help!

  10. #10
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Thumbs up

    Right on.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •