PDA

View Full Version : setActiveItem - Missunderstanding?



arkos
29 Aug 2011, 6:22 AM
hi,

i try to change the current panel using the setActiveItem-method. but nothing seems to work.

this error is thrown


TypeError: Result of expression this.layout.setActiveItem [undefined] is not a function.


using this code


Ext.setup({
onReady: function() {

Ext.regModel('gew', {
fields: [
{name: 'id', type: 'string'},
{name: 'name', type: 'string'},
{name: 'ort', type: 'string'}
]
});

var itemTemplate = new Ext.XTemplate(
'<tpl for=".">',
'{name}',
'</tpl>');


var jsonStore = new Ext.data.Store({
model: "gew",
proxy: {
type: 'ajax',
url: 'php/getSomething.php',
reader: {
type: 'json',
root: 'result'
}
},
sorters: 'ort',
getGroupString: function (record) {
return record.get('ort');
},
autoLoad: true
});

var list = new Ext.List({
id: 'indexlist',
indexBar: true,
grouped: true,
itemTpl : '{name}',
store: jsonStore,
scope: rootpanel,

onItemDisclosure: function (record, btn, index) {
Ext.getCmp('xroot').setActiveItem('map',{type: 'slide'});
// tried: Ext.getComponent, Ext.getCmp, this.get... and and and :(
}
});
var map = new Ext.Map({
id: 'map',
getLocation: true,
mapOptions: {
zoom: 12
}
});
var gewpanel = new Ext.Panel ({
id: 'gewp',
fullscreen: true,
layout: 'fit',
items:
[list]
});
var rootpanel = new Ext.Panel({
id: 'xroot',
fullscreen: true,
animation: 'slide',
items: [map,gewpanel]
});

}
})


(i'am trying to create a list and show a map by tabing a listentry)

arthurakay
29 Aug 2011, 11:37 AM
Your "rootpanel" does not have a defined layout... so setActiveItem() isn't a function that exists.

Read about the layout config:
- http://dev.sencha.com/deploy/touch/docs/?class=Ext.Panel

setActiveItem() exists in certain layouts, like "card".

arkos
29 Aug 2011, 12:17 PM
thank you. putting it all in an ext.application and defining a layout solved my problem. i come closer understanding the dependencies... step by step ;)

btw. how can i change the thread-prefix to 'answered' - or is this admin-stuff?

greets from hamburg
a.