PDA

View Full Version : TreeStore model fields not visible - and other questions



lrayman
12 Aug 2013, 10:05 AM
I have a model class that worked find in a normal grid, but now I'm trying to get it to work in a tree panel.

Question #1: the fields defined in the model are not visible on the individual instances. For example, in my tree store load callback, I can see the correct number of records returned, but each record's 'data' object only has the NodeInterface fields defined. The 'raw' object DOES have the data sent from the server.

How do I get the 'raw' fields (which are all defined in the model) to shine thru to the data object (so they, in turn, will be visible from the grid)?

Question #2: The model uses the 'batchKey' field (see the raw object below) as the idProperty. How can I get the TreeStore to use that field when it passes requests the children of that particular node?

I'm running ExtJS V4.1.1

This is the chrome inspector on one of the instances returned


0: constructor





childNodes: Array[0]
data: Object

allowDrag: true
allowDrop: true
checked: null
children: null
...
leaf: false
loaded: false
loading: false
parentId: undefined
qtip: ""
qtitle: ""
root: false
text: "Borrrows"
__proto__: Object

dirty: false
editing: false
events: Object
firstChild: null
hasListeners: HasListeners
id: "Ext.data.Store.ImplicitModel-BatchTree-ext-record-9"
internalId: "ext-record-9"
lastChild: null
modified: Object
nextSibling: constructor
parentNode: constructor
phantom: false
previousSibling: null
raw: Object

referenceId: null
abStatus: null
abSubmissionId: null
acceptedOrdersCnt: 0
batchKey: "LOAN_TYPE-Borrrows"
canceledOrdersCnt: 0
expiredOrdersCnt: 4
groupTitle: "Borrrows"
leaf: false
openOrdersCnt: 0
rejectedOrdersCnt: 0
text: "Borrrows"
totalOrdersCnt: 4
__proto__: Object

removedFrom: 2
store: null
stores: Array[0]

lrayman
15 Aug 2013, 10:27 AM
The answer was in a well-hidden comment on the 'model' configuration of the tree store:

http://docs.sencha.com/extjs/4.1.1/#!/api/Ext.data.TreeStore-cfg-model