PDA

View Full Version : Remove an item from Window???



adanali
24 Jun 2013, 1:10 AM
I have a window like this;


var window = new Ext.Window({
id : 'my-new-window',
height : 400,
width : 400,
layout : 'form',
items : [],
buttons : [{
text : 'Add Item',
handler : function() {
Ext.getCmp('my-new-window').add(Defined Field Before)
}
}, {
text : 'Remove Last Item',
handler : function() {
var lastItem = Ext.getCmp('my-new-window').items.length - 1;
Ext.getCmp('my-new-window').remove(Ext.getCmp('my-new-window').items[lastItem])
}
]
})

If i ask from firebug console
Ext.getCmp('my-new-window').items.length it answer 0 but window layout doesn't changes. (I tried doLayout() function)

How i can remove last item and refresh view???

adanali
24 Jun 2013, 3:34 AM
var window = new Ext.Window({
id : 'my-new-window',
height : 400,
width : 400,
layout : 'form',
items : [],
buttons : [{
text : 'Add Item',
handler : function() {
Ext.getCmp('my-new-window').add(Defined Field Before)
}
}, {
text : 'Remove Last Item',
handler : function() {
var lastItem = Ext.getCmp('my-new-window').items.length - 1;
Ext.getCmp('my-new-window').remove(Ext.getCmp('my-new-window').items.items[lastItem])
}
]
})

Sorry, this works...