-
12 Jan 2012 5:52 AM #1
loading dataIndex tree.Panel
loading dataIndex tree.Panel
Hi, I'm doing a really simple tree.Panel, and Im trying to use some columns but it doesnt load the dataindex apart from the 'text' one... this is the code:
Thank you for any help...Code:var store = Ext.create('Ext.data.TreeStore', { root : { expanded : true, children : [{ text : "detention", description : 'asdfasdf', leaf : true }, { text : "homework", description : "asdfasdf", children : [{ text : "book report", description : 'hola', leaf : true }, { text : "alegebra", description : "haha", leaf : true }] }, { text : "buy lottery tickets", description : "kajsdf", leaf : true }] } }); Ext.define('managerUserText', { extend : 'Ext.tree.Panel', initComponent : function() { var me = this; me.store = store; me.fields = ['text', 'des']; me.columns = [{ xtype : 'treecolumn', text : 'i_Property', dataIndex : 'text', width : 200 }, { text : 'i_Description', dataIndex : 'description', flex : 1, width : 200 }]; me.callParent(arguments); } })
-
12 Jan 2012 8:23 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
You shouldn't use Ext.create outside of Ext.define or Ext.onReady. If you have more than one instance of this tree panel, it will share the same store.
The issue is your store didn't know about the description field:
Code:Ext.define('managerUserText', { extend : 'Ext.tree.Panel', //TODO NEED AN ALIAS initComponent : function() { var me = this; me.store = Ext.create('Ext.data.TreeStore', { fields : ['text', 'description'], root : { expanded : true, children : [{ text : "detention", description : 'asdfasdf', leaf : true }, { text : "homework", description : "asdfasdf", children : [{ text : "book report", description : 'hola', leaf : true }, { text : "alegebra", description : "haha", leaf : true }] }, { text : "buy lottery tickets", description : "kajsdf", leaf : true }] } }); me.columns = [{ xtype : 'treecolumn', text : 'i_Property', dataIndex : 'text', width : 200 }, { text : 'i_Description', dataIndex : 'description', flex : 1, width : 200 }]; me.callParent(arguments); } });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote