View Full Version : Problem with extend store

11 Jan 2012, 1:32 PM
I'm still a newbie at extjs development, and i having an error with my treestore, but i think the problem its on the way that i had coded my base store...

When i open the window wich has the tree, the data is loaded correctly, but when i close the window and try to reopen it, i receive this error from the console:

url is undefined

return url + (url.indexOf('?') === -1 ? '?' : '&') + s;

My treestore code:

Ext.define('gconnect.store.Financeiro.Categorias.PlanoContas.FormTreeCombo', {
extend: 'Ext.helper.Abstract.TreeStore',
model: 'gconnect.model.Financeiro.Categorias.PlanoContas.FormTreeCombo',
autoLoad: false,
root: {
children : []

customIdProperty: 'codplanocontas',
urlRead: baseurl+'financeiro/categorias/listar_plano_contas',
urlCreate: undefined,
urlUpdate: undefined,
urlDestroy: undefined

The extended base store

Ext.define('Ext.helper.Abstract.TreeStore', {
extend: 'Ext.data.TreeStore',

customIdProperty: undefined,
urlRead: undefined,
urlCreate: undefined,
urlUpdate: undefined,
urlDestroy: undefined,

constructor: function(){
this.proxy = {
method: 'POST',
type: 'ajax',
actionMethods: {read : 'POST', create : 'POST', update : 'POST', destroy : 'POST'},
api: {
read: this.urlRead,
create: this.urlCreate,
update: this.urlUpdate,
destroy: this.urlDestroy

reader: {
idProperty: this.customIdProperty

On the constructor i set the read url, but when i need to reopen the window and reload the data, the treestore doesn't execute the constructor func. If someone could help me here... Thanks!

11 Jan 2012, 2:21 PM
Someone has any idea what could happening with this bug?
Well, i updated my source code with the 4.1 and the problem with url undefined has gone, but i cant use this version... My app it's full of bugs because of it, on 4.07 everything is running fine...

See some pictures:

When i click on categorias menu, the left sidebar loader don't dissapear... :?

So, to try to open my window, i removed the loader with firebux... :D
and, here is my new window on 4.1 version... xD


This window should be like this, their apparence on 4.1 version... I'm going crazy... XD

11 Jan 2012, 2:37 PM
Ok, i had discovered that it is and resolved bug on 4.1 version, but if you are with this bug and can't/don't wanna to use the 4.1 beta version, you just need to override your tree store with this code:

Ext.override(Ext.data.TreeStore, {
load: function(options) {
options = options || {};
options.params = options.params || {};

var me = this,
node = options.node || me.tree.getRootNode(),

// If there is not a node it means the user hasnt defined a rootnode yet. In this case lets just
// create one for them.
if (!node) {
node = me.setRootNode({
expanded: true

if (me.clearOnLoad) {
// this is what we changed. added false

Ext.applyIf(options, {
node: node
options.params[me.nodeParam] = node ? node.getId() : 'root';

if (node) {
node.set('loading', true);

return me.callParent([options]);

Posted originally by @ExtJSNinjas (http://www.sencha.com/forum/member.php?318897-ExtJSNinjas) on this page:

(http://www.sencha.com/forum/member.php?318897-ExtJSNinjas)F (http://www.sencha.com/forum/member.php?318897-ExtJSNinjas)inally, problem solved!