PDA

View Full Version : getActiveItem().update(data) works on browser but not on iPhone Simulator



siebmanb
2 Sep 2011, 12:56 AM
Hello everyone,
I looked everywhere and tried everything I couldn't find a solution.
I have a TabPanel with Components as tabs. I am trying to update tab content with a JSONP request when opened.
I used the following code to update the content :

tabs.getActiveItem().update(data);

(tabs it the name of my TabPanel)

It worked fine on Safari, but doesn't on the iPhone Simulator. The data is well received, but the component doesn't update. Can you guys give me a hand please ?

Thanks in advance.

siebmanb
8 Sep 2011, 11:33 PM
Here is the workaround I found.
I place a listener on the tab I want to update when opened :

listeners: {
show: function(){
Ext.ControllerManager.get('MyController').updateFunctionInController();
}
},


In my controller, the function gets the data through a JSONP request and then call a refresh function in the view, passing the data and the object id to update.
In the view, you have this method :

refresh: function(data,id) {
this.getComponent(id).update(data);
},


You obviously need to add IDs to your objects to be updated.

If anyone needs help with this, don't hesitate to contact me.

dash74
29 Feb 2012, 7:06 AM
Hi Siebmanb,

I'm a newbye and I'm trying to write some code using Sencha Touch 2 B3.
Your Tab is a list for me populated by a Jsonp request and like:

notesLists = Ext.create( 'Ext.List', {
id: 'notesList',
flex: 1, .
itemTpl: '<div class="list-item-title">{Surname}...........................

My list is populated by Jsonp request:

notesLists.updateData(data); //when the request exit with success

I don't have a Control definition so I can't figure out how to adapt your code.
The only way to run my code with success is to run it on Chrome browser.

Any help is appreciated.

David

siebmanb
29 Feb 2012, 2:25 PM
Hello,

Sencha Touch 2 is really different from ST1.X. I don't really know how to help you.
What do you mean by "it only works in Chrome" ? Then where does it not work ?

Regards,

dash74
29 Feb 2012, 11:50 PM
Hi Siebmanb,

it's in my previous title :), my code works very well in Ripple emulator and in Chrome,
but I can't see anything (data rows) neither in a real Blackberry device or in a simulator (they are
with built in webkit browser)
Can you show me how to do with ST 1.X? My original code is in this versione (grabbed from Internet) but I'm translating it to the new version.

David

siebmanb
1 Mar 2012, 12:19 AM
Ok sorry for not reading the title.

My code changed a lot since that post and I don't have those lines anymore. But the fact that it works in some browser/simulator and not others makes me think it is not related to the overall code but to one small specificity on the BlackBerry. And I never coded on BB so I can't really help you. Sorry...

Good luck.