Question

I'm using Sencha Architect 3.0.1. I'm trying to use a Model, a TreeStore, and a TreePanel.

The Model:

Ext.define('User.model.ModelClientList', {
    extend: 'Ext.data.Model',
    fields: [{ name: 'id' }, { name: 'name' }, { name: 'status' } ],
    proxy: {
        type: 'direct',
        directFn: 'UserClient.listClient',
        reader: { type: 'json',root: 'data'}
    }
});

The TreeStore:

Ext.define('User.store.StoreClientList', {
    extend: 'Ext.data.TreeStore',
    constructor: function(cfg) {
        var me = this;
        cfg = cfg || {};
        me.callParent([Ext.apply({
            model: 'User.model.ModelClientList',
            storeId: 'StoreClientList'
        }, cfg)]);
    }
});

And the TreePanel:

{
    xtype: 'treepanel',
    height: 250,
    itemId: 'MainClient',
    width: 400,
    title: 'Clients',
    hideHeaders: false,
    store: 'StoreClientList',
    rootVisible: false,
    viewConfig: {loadMask: true},
    columns: [
        {xtype: 'treecolumn',dataIndex: 'name',text: '..'},
        {xtype: 'gridcolumn', dataIndex: 'status', text: '..'}
    ]
}

The json request to UserClient.listClient returns this:

{
"data":[
    {"id":1,"name":"Pluto","status":3,"children":[
        {"id":35,"name":"Mela","status":2,"leaf":true},
        {"id":36,"name":"Pera","status":1,"leaf":true},
        {"id":37,"name":"Arancia","status":1,"leaf":true}]},
    {"id":2,"name":"Pippo","status":1,"leaf":true},
    {"id":3,"name":"Paperino","status":2,"leaf":true}],
"success":true
}

Now, can someone explain me:

(1) Why, when I click on [+] icon of the first node the application does another ajax request instead of expanding what already got from the previous request

(2) Given this initial view:

Initial tree view

Why when I click on the [+] it starts going crazy like this:

App went crazy

Was it helpful?

Solution

It was clearly a problem of Sencha Architect.

I rewrote from scratch in a new project the same architecture and now it works as expected.

Also, I noticed that something was going wrong with Architect becouse of simple operation made it show incomprehensible and undebuggable errors (like "Cannot set property 'DirectCfg' of null").

Unfortunately I cannot state that Sencha Architect is mature for large and complex project.. probably not even for small project. what a pity

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top