tags:

views:

33

answers:

1

I want to use the data of my grid in an other grid when I create a window, I call a function and give it parameter, so I want that the grid in my window use this data

//In my main pag functionThatCreatesMyWindow(villeGrid.store.data);

//In my window myGrid.store.loadData(myParameter);

It doesn't work :(

+1  A: 

First of all, you need to understand object scopes work in the DOM. If the store is named using a registered namespace, you can access any objects using that namespace from any JS within a document. When you have multiple windows, these will be functioning under two separate scopes.

In your scenario though there is a helper object that may be able to help you out.

Each store created on a page is automatically registered in the global, static, Ext.StoreMgr object. If the stores have storeID's (see docs for Ext.data.Store), you can use the Static StoreMgr object to reference the store in your window.

//returns reference to store object from the StoreMgr 
var referenceToStore = Ext.StoreMgr.getKey('myStoreID');

If that doesn't work, create a factory method where you pass a store to the method that can consume the store.

It Grunt