View Full Version : I need to place TreeStore data into Combobox

16 Aug 2014, 8:21 AM
Question. Please bare me because I am still new with extjs

I am trying to modify the output of an existing (GroupingTree) Tree store to something useful for the simple Combo box drop down because
the server side code is not returning data in the format that I need.
I created a UI Combobox in the code exmple shown below (my function code is commented out)
My store (a Tree store) is coming from a file named GroupingTree.js

but for some reason my function “getCustomStore” is not getting called so “customStore” is not being returned

My Function code

Ext.define('TV.view.configPanel.data.edit.analyticControls.CustomCaptionNew', {
extend: 'Ext.form.field.ComboBox',
alias: 'widget.customcaptionNew',
id: 'txtCustomCaption', //TODO: Remove ID - Check with QA
isFormattingControl: true,
* Initialization of CustomCaption
* @method initComponent
initComponent: function () {
var config = {
fieldLabel: 'Custom Caption as Dropdown',
blankText: TV.Global.ErrorMessages.CustomCaptionError,
name: 'Caption',
anchor: '100%',
allowBlank: false,
validateOnChange: true,
vtype: 'name',
minChars: 2,
typeAhead: 'true',
valueField: 'aggregationCode',
name: 'aggregationName',
/*store: new Ext.data.SimpleStore({fields:['aggregationCode','aggregationName'],
data: [['agg1','Cusip'],
store: getCustomStore()


Ext.apply(this, Ext.apply(this.initialConfig, config));
// Custom validator. For validating the entered caption for analytic.
Ext.apply(Ext.form.field.VTypes, {
name: nameValidator,
nameText: TV.Global.ErrorMessages.blankText
var getCustomStore = function(){
/*var customCaptionStore = {};
var fields = ["aggregationName", "aggregationCode"];
var data = [{"name","Id"}];
//var tempStore = this.getStore(Store.GroupingTreeStore);
//alert("Got the proper store");
var fields = ['abbr', 'name'];
var data = [];
for (var x = 0; x < tempStore.getRootNode().childNodes[1].childNodes.length; x++){
data.push({name : tempStore.getRootNode().childNodes[1].childNodes[x].raw.text, abbr: tempStore.getRootNode().childNodes
var states = Ext.create('Ext.data.Store', {
customCaptionStore = Ext.create('Ext.data.Store', {
return customCaptionStore;*/
alert("Called debug");
return new Ext.data.SimpleStore({fields:['aggregationCode','aggregationName'],
data: [['agg1','Cusip'],

Grouping tree.js store code
Ext.define('TV.store.GroupingTree', {
extend: 'Ext.data.TreeStore',
filtered: false,
model: 'TV.model.AggregationTag',
proxy: {
type: 'direct',
directFn: ContainerConfigurationData.GetAggregations,
paramOrder: ['clientId', 'nodeToLoad', 'searchKey'],
paramsAsHash: true
autoLoad: false,
treeField: TV.constants.Constant.DataTabFields.GroupingsTreeColumnName,
//groupField: 'Category',
root: {
expanded: true,
loaded: true // Because groupfield is not defined, this is actually required for loading

Please help. This is killing me

16 Aug 2014, 10:24 AM
This might help: