开发者

EXTJS using the data of a grid in an other grid

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 :(


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜