PDA

View Full Version : Is possible refresh DataView' store through including?



andredecotia
23 Dec 2010, 4:07 AM
Hey, good morning (my time LOL),

I would like to know if is possible refresh DataView' store if DataView' store were inside another file that I get access
by including (included)... Is that possible or not?

Condor
23 Dec 2010, 4:48 AM
The store needs to be globabally accessible.

Either assign it to a global variable or give the store a unique id and use Ext.StoreMgr.get('id-of-store').

andredecotia
23 Dec 2010, 5:05 AM
Hey Condor, first of all, thx for rapid helping...

1 - How to set my store as a global variavel?

2 - How does Ext.StoreMgr.get('id-of-store') work? How to improve my code using that?

Look at my code pls.:

var store = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'resultgaleria.action',
method: 'POST'
}),

root: 'linhas',

fields: [
{name: 'idsDosThumbs', type: 'int', allowBlank: true},
{name: 'nomesDosThumbs', type: 'string', allowBlank: true},
{name: 'urlFotoOriginal', type: 'string', allowBlank: true},
{name: 'urlsDosThumbs', type: 'string', allowBlank: true}
]
});

Animal
23 Dec 2010, 5:12 AM
Not global, just accessible in the OBJECT MODEL of your app.

Your app does have an object model doesn't it? It's not just thousands of statements???

andredecotia
23 Dec 2010, 5:13 AM
I think I have understood now when you say to use Ext.StoreMgr.get('id-of-store') get access then how to set
an id to my store? This is my current difficult.

Condor
23 Dec 2010, 5:14 AM
Add id:'my-store-id' to the store config and in the other file use:

var store = Ext.StoreMgr.lookup('my-store-id');
store.reload();

andredecotia
23 Dec 2010, 5:15 AM
My apologize, I don't know what Object Model is...

andredecotia
23 Dec 2010, 5:21 AM
Condor, Condor, very very happy...
I don't believe I think that works now LOL... Let me test again, ok? :D :D :D

Condor
23 Dec 2010, 5:21 AM
Animal means you should modularize your application.

Create one root object (e.g. MyApp) in the global namespace and add parts of the application as properties to that object.

andredecotia
23 Dec 2010, 5:28 AM
wow wow... I am sure that's working perfectly! Condor you are the man! You're the master! You're the world's EXTjs number one!

Animal thanks as well...

bye bye,
André AS - Brazil