View Full Version : MVC TreeGrid problems with store.getRootNode

5 Oct 2011, 12:39 AM

I'm testing with ext 4.0.2 and trying to get a mvc treegrid working. Without the store it works but when i set the store i get an exception "Object has no method getRootNode" in the following lines of code

me.viewConfig = Ext.applyIf(me.viewConfig || {}, {
rootVisible: me.rootVisible,
animate: me.enableAnimations,
singleExpand: me.singleExpand,
node: me.store.getRootNode(),

hideHeaders: me.hideHeaders


Ext.define('AM.store.treeStore', {
extend: 'Ext.data.Store',
model: 'AM.model.treeModel',
autoLoad: true,

proxy: {
type: 'ajax',
url: 'http://dev.sencha.com/deploy/ext-4.0.2a/examples/tree/treegrid.json',
reader: {
type: 'json',
root: 'text'

folderSort: true


Ext.define('AM.model.treeModel', {
extend: 'Ext.data.Model',
fields: [
{ name: 'task', type: 'string', dataIndex : 'task' },
{ name: 'user', type: 'string', dataIndex: 'user' },
{ name: 'duration', type: 'string', dataIndex: 'duration' }


Ext.define('AM.controller.treeController', {
extend: 'Ext.app.Controller',

stores: ['treeStore'],

models: ['treeModel'],

views: ['treeView'],

init: function () {
console.log('event fired!');


Ext.define('AM.view.treeView', {
extend : 'Ext.tree.Panel',
alias : 'widget.treeView',
title: 'Test',
width: 500,
height: 300,
collapsible: true,
useArrows: true,
rootVisible: false,
store: 'treeStore',
multiSelect: true,
singleExpand: true,
columns: [{
text: 'Task',
flex: 2,
sortable: true,
dataIndex: 'task'
text: 'Assigned To',
flex: 1,
dataIndex: 'user',
sortable: true

As you can see i'm using the simple test app with AM namespace and the standard treegrid.json from the example site.

In the docs the store does not have the method .getRootNode so i'm not sure this is a bug or if i'm doing something wrong. Hope you guys can help.