View Full Version : Passing complex tree node to the server

27 Feb 2012, 5:39 PM
I have a tree in my application that defines the following model

Ext.define('QuiApp.model.ReportTreeNode', {
extend: 'Ext.data.Model',

idProperty: 'execId',

fields: [
name: 'execId'
name: 'name'
name: 'parentId'
name: 'factoryName'
name: 'execCount'

However when I attempt to drill into the top node I always get this limited GET request: http://localhost:8080/qui/reports/tree/viewTree.action?_dc=1330390656114&node=
The node parameter is always empty so I'm guessing that my store/proxy and reader are not configured correctly. Here's store code:

Ext.define('QuiApp.store.base.ReportTreeStore', {
extend: 'Ext.data.TreeStore',
requires: [

constructor: function(cfg) {
var me = this;
cfg = cfg || {};
autoLoad: true,
storeId: 'ReportTreeStore',
model: 'QuiApp.model.ReportTreeNode',
nodeParam: 'node',
proxy: {
type: 'ajax',
url: 'http://localhost:8080/qui/reports/tree/viewTree.action',
reader: {
type: 'json',
idProperty: 'id',
messageProperty: 'name'
}, cfg)]);

How do I reconfigure this to provide complete node information in request?

28 Feb 2012, 12:56 PM
The node property that is sent will be the id.

28 Feb 2012, 1:47 PM
I tried changing nodeParam (if that is what you are referring to to "id" but that has no effect. I don't see anything being sent. Also is there a way to sent whole JSON for the tree node I selected?

28 Feb 2012, 1:53 PM
No, there is no way to send the entire data of that node.

If you specify an id for that node, it will send the id to the server in a post.

28 Feb 2012, 2:22 PM
You mean no way with type of proxy Designer 2 supports? Why can I use
Ext.data.HttpProxy and send that JSON as body doing a POST? Anyways like I said, even when I do nodeParam: 'id' or 'execId' I always see empty node in the GET request

28 Feb 2012, 2:28 PM
Of course it could be implemented but its not supported out of the box.

You would have to override the tree behavior. I can't tell by first glance at whats wrong with why its not sending the id. You will probably have to step through the load process.

28 Feb 2012, 2:33 PM
Just to be clear. Right now if I modify any JS files by hand there's no way of importing changes back to Designer 2? Are you referring to Ext.load?

28 Feb 2012, 2:38 PM
You can modify external files like overrides without problem.

I am referring to the load process of treenodes as they are expanded.

28 Feb 2012, 2:45 PM
Is there any example on how to create overrides? I'm very new to Ext JS and struggling with basic concepts. I like to use Designer to layout my components but what are the best practices for writing code for the actual project? I'm using Eclipse with JS tools (beside the Designer) and Spring MVC on the back end. I would like to have Designer files always generated by tool but how to incorporate that with files I'll be coding by hand? Sorry for offtopic

28 Feb 2012, 8:27 PM