PDA

View Full Version : Get grid from diferent window without id



neosky
3 Sep 2014, 4:26 AM
Hello i am have form with (grid and button), and when i am click button, then open other window, with button, and i am want get grid from 1 window, by click button in 2 window (but i am want do it without 'Id')

this code 1 window:

{ extend: 'Ext.grid.Panel',
alias: 'widget.bookwidg',
title: 'book',
name: 'booklist',


this function click button fron 2 window:


bookFun: function(button) {
var win = button.up('window');
grid = win.down('grid');

but i am have error , help me

scottmartin
3 Sep 2014, 5:33 AM
Do you mean something like this?



var win1 = Ext.widget('window', {
autoShow: true,
title: 'Win1',
height: 250,
width: 250,
x: 0,
y: 0,
layout: 'fit',
items: [{
title: 'myPanel'
}],
tbar: [{
text: 'Move from Win1 to Win2',
handler: function () {
var panel = win1.down('[xtype=panel]');
win1.remove(panel, false);
win2.add(panel);
}
}]
});

var win2 = Ext.widget('window', {
autoShow: true,
title: 'Win2',
height: 250,
width: 250,
layout: 'fit',
x: 260,
y: 0
});

neosky
4 Sep 2014, 12:05 AM
thank you for answer, but this not what I wanted. I am have window with button and grid, and when i am click button i am show other window with button and when i am click this button i want get grid from first window

i can do this through 'id' var grid = Ext.getCmp('booklist'); but i need do without 'id', use 'name' parametr or something other
50222

scottmartin
4 Sep 2014, 4:21 AM
Do you have any reference to the other window like itemId or special xtype to where you can reference it by using Ext.ComponentQuery.query('#my-item-id') or 'xtype'. If not then assign an itemId to the window and then you can use
mywindow.down('grid'), or assign an itemId to the grid if you just want the grid.