PDA

View Full Version : [solved] ext.fly().load() 'loads' into wrong target



Somani
3 Jan 2010, 1:50 PM
Hi Community

I have a small script to update some div-content (update from a remote file). Lets see the Code:

xtype: 'treepanel',
lines: false,
loader: new Ext.tree.TreeLoader(),
root: new Ext.tree.AsyncTreeNode({
expanded: true,
children: [{
text: 'Benutzer erstellen',
id: 'user_create',
icon: 'images/icons/fam/user_add.png',
leaf: true
}, {
text: 'Benutzer ändern',
id: 'user_edit',
icon: 'images/icons/fam/user_edit.png',
leaf: true
}, {
text: 'Benutzer löschen',
id: 'user_delete',
icon: 'images/icons/fam/user_delete.png',
leaf: true
}]
}),
rootVisible: false,
listeners: {
click: function(n) {
var includeURL = 'includes/pages/' + n.attributes.id + '.php';
Ext.fly('center').load(includeURL);
}
}So, here is the Problem:
If i click one of the tree-items it updates the text of this item with the content of the targeted file (instead of the div with the 'center' id).

If i use
Ext.fly('center').update('some text);The div 'center' gets successfully updated with 'some text' .

Thats confusing me -.- maybe someone can give me a hint ;)

thank you

Somani
3 Jan 2010, 2:06 PM
omg! some curious searching terms in this forums gave me a solution:


xtype: 'treepanel',
lines: false,
loader: new Ext.tree.TreeLoader(),
root: new Ext.tree.AsyncTreeNode({
expanded: true,
children: [{
text: 'Benutzer erstellen',
id: 'user_create',
icon: 'images/icons/fam/user_add.png',
leaf: true
}, {
text: 'Benutzer ändern',
id: 'user_edit',
icon: 'images/icons/fam/user_edit.png',
leaf: true
}, {
text: 'Benutzer löschen',
id: 'user_delete',
icon: 'images/icons/fam/user_delete.png',
leaf: true
}]
}),
rootVisible: false,
listeners: {
click: function(n) {
var includeURL = 'includes/pages/' + n.attributes.id + '.php';
var el = Ext.get('center');
var mgr = el.getUpdater();
mgr.update({
url: includeURL,
text: 'Lade ...'
});
}
}xtype: 'treepanel',
lines: false,
loader: new Ext.tree.TreeLoader(),
root: new Ext.tree.AsyncTreeNode({
expanded: true,
children: [{
text: 'Benutzer erstellen',
id: 'user_create',
icon: 'images/icons/fam/user_add.png',
leaf: true
}, {
text: 'Benutzer ändern',
id: 'user_edit',
icon: 'images/icons/fam/user_edit.png',
leaf: true
}, {
text: 'Benutzer löschen',
id: 'user_delete',
icon: 'images/icons/fam/user_delete.png',
leaf: true
}]
}),
rootVisible: false,
listeners: {
click: function(n) {
var includeURL = 'includes/pages/' + n.attributes.id + '.php';
var el = Ext.get('center');
var mgr = el.getUpdater();
mgr.update({
url: includeURL,
text: 'Lade ...'
});
}
};)