PDA

View Full Version : TreeGrid not showing labels ...



armandoxxx
23 Oct 2012, 10:13 AM
Hey guys ..

Need a little help with my problem ...

The tree renders but columns are empty:


here is my model code:



Ext.define('Dropchop.analysis.model.ClassRating',
{
extend : 'Ext.data.Model',
fields : [
{name : 'uuid', mapping : 'uuid', type : 'string'},
{name : 'title', mapping : 'title', type : 'string'},
{name : 'rating', mapping : 'rating', type : 'string'},
{name : 'description', mapping : 'description', type : 'string'}
]
}
);


TreeGrid:


Ext.define('Dropchop.analysis.tree.ClassRatingTree',{

extend : 'Ext.tree.Panel',

title : Dict.get('adminui_analysis_class_treegrid_title'),
border : false,
useArrows : true,
rootVisible : false,
multiSelect : true,
singleExpand : true,

constructor : function(theConfig) {

this.initConfig(theConfig);
this.callParent(arguments);
},


initComponent : function() {

Ext.apply(this,
{
dockedItems : [
{
xtype : 'toolbar',
dock : 'top',
items : [
{
xtype : 'button',
iconCls : 'icon-add',
listeners : {
scope : this,
click : function(theButton, theOptions) {
//do something...
}
}
}
]
}
],
columns : [
{
xtype : 'treecolumn', //this is so we know which column will show the tree
text : Dict.get('adminui_analysis_field_entity'),
width : 200,
dataIndex : 'title'
},
{
text : Dict.get('adminui_analysis_field_rating'),
dataIndex : 'rating'
},
{
text : Dict.get('adminui_analysis_field_quoted_source_desctiprion'),
dataIndex : 'description'
},
{
text : Dict.get('adminui_analysis_field_uuid'),
dataIndex : 'uuid'
}
],
store : new Ext.create('Ext.data.TreeStore',
{
storeId : 'Dropchop.analysis.store.ClassTreeStore',
model : 'Dropchop.analysis.model.ClassRating',
defaultRootProperty : 'data',
proxy : {
type : 'ajax',
url : LOAD_ANALYSIS_CLASS_RATINGS_PATH,
reader : {
type :'json',
root : 'data'
}
},
folderSort : true

}
)
}
);

this.callParent(arguments);
}

});


Json output:



{
"total" : "4",
"data" :
[
{
"uuid" : "df958240-e361-4867-8ec4-4d6511dbd339",
"title" : "TESTCLASS1",
"rating" : "8",
"description" : "adsfasdf",
"iconCls" : "task-folder",
"leaf" : "true"
},
{
"uuid" : "f8c85603-ba5b-49fd-977e-5c3b225e8b17",
"title" : "TESTCLASS2",
"rating" : "13",
"description" : "asdfadsf",
"iconCls" : "task-folder",
"leaf" : "true"
},
{
"uuid" : "f51ed934-1866-47a1-a1c3-8488287cdc42",
"title" : "TESTCLASS3",
"rating" : "7",
"description" : "test",
"iconCls" : "task-folder",
"leaf" : "true"
},
{
"uuid" : "b454106d-b4e0-474c-beb6-d7f20c536a13",
"title" : "TESTCLASS4",
"rating" : "15",
"description" : "test",
"iconCls" : "task-folder",
"leaf" : "true"
}
]
}


Any help would be appreciated

Regards

Armando

armandoxxx
23 Oct 2012, 10:09 PM
Hey

I solved it. I was missing Ext.require() statement before tree.

Rgards

Armando