PDA

View Full Version : A simple browser example in Sensa ?



laurent64
16 Sep 2010, 7:13 AM
Good afternoon everyone,

i want to load a web page in a Panel (such as google.com), what is the simpliest way to do that ?
I have tried <pane>.update(<myUrl>) => but the URL is then just printed in the panel




function initialize(){

function getGooglePage(){
return 'http:\\\\www.google.fr\\'
}

function setWebPage(){
Ext.getCmp('content').update(getGooglePage());
}

var validButton =
{
xtype:'button',
text:'valider',
handler:setWebPage
}

var mainPanel =
{
xtype:'panel',
scroll : 'vertical',
id:'content'
}

new Ext.Panel({
fullscreen : true,
id : 'main_panel',
scroll : false,
items:[ validButton, mainPanel ],
layout : 'vbox'
});

}

Ext.setup({
onReady: initialize
});

jay@moduscreate.com
16 Sep 2010, 7:56 AM
The api clearly states that the update method is to inject html fragments. Why would you want to load an iframe in a mobile app?

elishnevsky
16 Sep 2010, 8:13 AM
It's Sencha, not Sensa.

jay@moduscreate.com
16 Sep 2010, 8:15 AM
It's Sencha, not Sensa.

I honestly don't know why the name is so hard for people. :(

VinylFox
16 Sep 2010, 8:17 AM
He probably followed the config link from the load method, which links to the update method of the Ext.Updater. Can be a bit confusing if your not paying attention, since both Element and Updater have an update method.

Anyway...use load, not update.


function setWebPage(){
Ext.getCmp('content').load({url:getGooglePage()});
}

laurent64
16 Sep 2010, 9:40 AM
Good evening.

First, i apologize for the mistake 'Sensa' (maybe because of 'Senseo' machine ...).
I want to do a simple browser first, because, in a second time, i want to work with Google Charts Tools, by Sencha API. Just to be used to Sencha api.
FInally, the method load is not recognized for 'content', the javascript console say me that it is just an Object.

Thanks for helps. :)

VinylFox
16 Sep 2010, 9:49 AM
Oh yeah, you probably want the 'body' element of the panel.


function setWebPage(){
Ext.getCmp('content').body.load({url:getGooglePage()});
}

laurent64
16 Sep 2010, 9:56 AM
I didn't know that the Panel had a Body element inside.
But it doesn't work : "Unexpected token [ "
Thanks for your help :)

VinylFox
16 Sep 2010, 9:58 AM
You should take a look into JSLint and FireBug, it would help you out allot.

laurent64
16 Sep 2010, 10:03 AM
Thank you

jay@moduscreate.com
16 Sep 2010, 10:08 AM
He probably followed the config link from the load method, which links to the update method of the Ext.Updater.

There is no Ext.Updater for ST. Element.load actually calls Ext.Ajax.request directly. his is why "scripts: true" doesn't work.
touch.95/src/platform/src/core/Element.js
http://tdg-i.com/img/screencasts/2010-09-16_1407.png

There are a ton of "old-hat" Ext JS stuff that is left out of ST -- to the point where i get frustrated.

VinylFox
16 Sep 2010, 10:14 AM
Interesting...that seems quite odd, when 3.2.1 code is so drastically different...


/**
* Direct access to the Updater {@link Ext.Updater#update} method. The method takes the same object
* parameter as {@link Ext.Updater#update}
* @return {Ext.Element} this
*/
load : function(){
var um = this.getUpdater();
um.update.apply(um, arguments);
return this;
},

I just made an assumption that would stay the same. Odd and def frustrating.

jay@moduscreate.com
16 Sep 2010, 10:34 AM
I just made an assumption that would stay the same. Odd and def frustrating.

I made that assumption a lot when developing a prototype app. :(

I got used to Ext.fx being tied in to Ext.Element --- nolonger the case in Ext.Platform + SenchaTouch.