View Full Version : TreeStore didn't expand after collapse

13 Apr 2014, 4:56 AM
hi, i'm new in extjs and i hope you can understand my english.

my problem: i have a viewport with store, a model for the store and items. at the items are some tabpanels, which need the same store, so as i initialize the tabpanels i delivered the store to them. that works perfectly and i see the treestore in both tabpanels.

BUT: if i collapse a branch from the treestore in one tabpanel and switch to an other tabpanel with the same treestore, i can't expand the branch, which i collapsed before.

has anyone an idea? please let me know. thx

13 Apr 2014, 4:13 PM
It would help to see your code. You can create an example in our fiddle:

Sounds like you are destroying something you should not be, or that you have duplicate id that is causing a collision.

14 Apr 2014, 3:38 AM
ok, here you can see some code:


Ext.define('Mainmenu', {
requires: [
extend: 'Ext.util.Observable',
constructor: function() {

var modelNutzer = Ext.extend(Ext.data.Model, {
fields: [
{ name:'text', type:'string' },
{ name:'online', type:'boolean' },
{ name:'sv', type:'boolean' },
{ name:'aktiv', type:'boolean' },
{ name:'nutzer_id', type:'integer' },
{ name:'type', type:'integer' }

var storeNutzer=this.storeNutzer = Ext.create('Ext.data.TreeStore', {
model: modelNutzer,
proxy: {
type: 'ajax',
url: config.server +'/?usertab',
pageParam: undefined,
startParam: undefined,
sortParam: undefined,
noCache: true
autoLoad: true,

var tabpage =this.tabpage= new Tabpage({storeNutzer:storeNutzer});

var viewport=my.viewport = new Ext.Viewport({
closable: false,
collapsible: false,
plain: true,
layout: 'border',
region: 'north',
layout: 'hbox',
border: false,
items: [ ... ]


Ext.define('Tabpage', {
requires: [

constructor: function(options) {
var usertab = new Usertab({storeNutzer:options.storeNutzer});
var accesstab = new Accesstab({storeNutzer:options.storeNutzer});
var tab=this.tab = new Ext.tab.Panel({
region: 'center',
items: [


Ext.define('Usertab', {
requires: [

constructor: function(options) {
var store=this.store =options.storeNutzer;
var grid=this.grid = new Ext.tree.Panel({
title: 'Nutzer',
itemId: 1,
layout: 'fit',
useArrows: true,
rootVisible: false,
multiSelect: true,
maxWidth: 500,
height: 150,
columns: [{
xtype: 'treecolumn',
resizable: false,
sortable: true,
dataIndex: 'text',
menuDisabled: true,
editor: {xtype: 'textfield'},
}, {
text: 'Online',
resizable: false,
xtype: 'checkcolumn',
dataIndex: 'online',
sortable: false,
menuDisabled: true,


Ext.define('Accesstab', {
requires: [

constructor: function(options) {
var storeNutzer=this.storeNutzer =options.storeNutzer;
var usertree= new Ext.create('Ext.tree.Panel',{
store: storeNutzer,
rootVisible: false,
border: true,
useArrows: true,
title: 'Nutzer',
titleAlign: 'center',
region: 'west',
collapsible: true,
titleCollapse: true,
[...] // var usertree will be integrated in other panels

i hope somebody can help :)

13 May 2014, 4:15 AM
hello, i tried some things and got intermediate result. necessary to know is my other problem: to add a node to the tree. if i try this, i get an error: Uncaught TypeError: undefined is not a function
i think, both problems have the same reason. i tried, only to add a child to the tree, like this: https://fiddle.sencha.com/#fiddle/1rg the important fact, which stroke out is, i tried to define somesthing with Ext.define and create some thing in the constructor, but in the example from fiddle, this use Ext.application and the launch-function. after this, i read a book about Ext.define and Ext.application, but i don't understand the different and how can i resolve my problem with using Ext.define() ??