PDA

View Full Version : facing error in loading Ext.us.tree.treegrid



amanind
24 Mar 2011, 12:39 AM
Hi

I am facing in loading json data

Data is not loading in grid



MS.ImpactSisterApp.FinancialProjectionsPanel = Ext.extend(Ext.ux.tree.TreeGrid, {


initComponent: function() {
this.memberTypeCombo = new MS.ImpactSisterApp.MemberTypeCombo();
this.gridFilter = new MS.ImpactSisterApp.SimpleStoreCombo({ style: 'font-size:11px;padding:1px 5px', disabled:false, width: 150 })
MS.ImpactSisterApp.setComboSimpleStore(this.gridFilter, MS.ImpactSisterApp.config.comboFieldTypes.gridFilter, MS.ImpactSisterApp.config.comboDataTypes.gridFilter);
/*var store = new Ext.tree.TreeNode({
data:[],
reader: new Ext.data.JsonReader({id: '_id'}, MS.ImpactSisterApp.GridTreeRecord )
});*/
debugger
this.store = new Ext.data.JsonStore({
data:[],
fields: ['fund', 'sync', 'validate', 'version', 'model_status', 'last_update_by', 'last_update_on']
});

var config = {
tbar: this.gridToolbar,
store: this.store,
master_column_id : 'fund',
columns: [
{ id: 'fund', header: 'Fund/Region/Investment/Models', dataIndex: 'fund', width: 230 },
{ id: 'sync', header: 'Sync status', width: 100, dataIndex: 'sync' },
{ id: 'validate', header: 'Validation', width: 150, dataIndex: 'validate' },
{ id: 'version', header: "Version", width: 250, sortable: true, renderer: this.showAsLink, dataIndex: 'version', minWidth: 100 },
{ id: "model_status", header: "Model Status", width: 100, renderer: this.showRadio, fixed: true, dataIndex: 'model_status', minWidth: 50 },
{ id: "last_update_by", header: "Last Updated By", width: 80, sortable: true, dataIndex: 'last_update_by', minWidth: 75 },
{ id: "last_update_on", header: "Last Updated On", width: 80, sortable: true, renderer: Ext.util.Format.dateRenderer('d M Y'), dataIndex: 'last_update_on', minWidth: 75 }
],

root_title: 'Investment Models',
style: 'font-size:8pt;font-family:helvetica;overflow:auto;',
autoScroll: true,
closable: true,
viewConfig: {
enableRowBody: true
},
stripeRows: true
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
MS.ImpactSisterApp.FinancialProjectionsPanel.superclass.initComponent.apply(this, arguments);

this.on('cellclick', this.modelSelected, this);
this.getSelectionModel().on('beforerowselect', this.beforeRowSelect, this);
this.gridFilter.on("select", this.loadSelectedFilterType, this);
this.on('render', this.onGridRender, this);
this.on('columnresize', this.columnResize, this);
this.memberTypeCombo.on("select", this.setSelectedMemberType, this);
//this.store.loadData(this.dataRows[1]);
//this.refreshInvestmentAssetModelsPanel(this.dataRows);

MS.ImpactSisterApp.SisterAppEventManager.on("setReportingPeriod", this.setReportingPeriod, this);
},
setReportingPeriod: function() {
this.reportingPeriodIdHold = arguments[0].Id;
this.reportingPeriodNameHold = arguments[0].Name;
},

refreshInvestmentAssetModelsPanel: function() {
debugger
if(arguments[0] && arguments[0].length > 0)
{
this.dataRows = arguments[0][1];
}else{
this.dataRows = [];
}
try{
this.store.removeAll();
}catch(ex){
}
this.store.loadData(this.dataRows);
},


onGridRender: function(grid) {
//this.getView().breadcrumbs_el.parent().remove();
//if(this.permission && this.permission.IsEntitled)Ext.getCmp(this.id + "-btnNewModel").setVisible(true); //Change here
},


beforeRowSelect: function(sm, rowIndex, keepExisting, rec) {
return false;
},

columnResize: function(col, width) {
var minWidth = this.getColumnModel().config[col].minWidth;
if (width < minWidth) {
this.getColumnModel().setColumnWidth(col, minWidth);
return false;
}
},

doResize: function(grid, newWidth, newHeight, oldWidth, oldHeight) {
var cm = grid.colModel;
var i = cm.getIndexById('desc');
var col = cm.getColumnById('desc');
if (this.width > 0) {
cm.setColumnWidth(i, col.width + newWidth - this.width);
this.width = this.getSize().width;
}
},

onDestroy: function() {
this.un('cellclick', this.modelSelected, this);
this.getSelectionModel().un('beforerowselect', this.beforeRowSelect, this);
this.gridFilter.un("select", this.loadSelectedFilterType, this);
this.un('render', this.onGridRender, this);
this.un('columnresize', this.columnResize, this);
this.memberTypeCombo.un("select", this.setSelectedMemberType, this);
MS.ImpactSisterApp.SisterAppEventManager.un("setReportingPeriod", this.setReportingPeriod, this);
}
});


MS.ImpactSisterApp.FinancialProjectionsPanel.prototype.formatNumber = function(value, meta, rec) {
if (!rec.data._showAsTitle) {
if(meta.id == "multiple" && value == 99999999){
var val = "Infinite";
}else{
var val = Ext.util.Format.formatNumber(value);
}
if(rec.data._isInQueue){
return '<span class="model-detail-isinqueue">' + val + '</span>';
}else{
return val;
}
}
};

MS.ImpactSisterApp.FinancialProjectionsPanel.prototype.showCombo = function(val, meta, rec, row, col, store) {
//return '<div style="font-size:11px"><input style="cursor:pointer;border:1px solid lightblue;font-size:11px;font-family:tahoma;width:80px;padding:3px 5px" type="text" value="' + rec.data.Status.Name + '" size="20"/></div>';
};


function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
return stringToTrim.replace(/\s+$/,"");
}


My JSON



{success:true, data:[{
fundName:'MSREF I',
Id:1,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
expanded: true,
children:[{
fundName:'America',
Id:11,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
parent_id:'1',
children:[{
fundName:'Investment1',
Id:111,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
parent_id:'11',
childern:[{
fundName:'Management',
Id:1111,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
parent_id:'111',
childern:[{
fundName:'Model1',
Id:11111,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
parent_id:'1111'
},{
fundName:'Model2',
Id:11112,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
parent_id:'1111'
}]
},{
fundName:'Others',
Id:1112,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
parent_id:'111'
}]
},{
fundName:'Investment2',
Id:112,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
parent_id:'11'
},{
fundName:'Investment3',
Id:113,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
parent_id:'11'
}]
}, {
fundName:'Asia',
Id:12,
sync:'Tommy Maintz',
validation:'task-folder',
Status:[{
Name:'Pending'
}],
Owner:[{
Name:'Pending',
dateon: '\/Date(1254283200000-0400)\/'
}],
parent_id:'1',
expanded: true,
children:[{
task:'Retile kitchen',
duration:6.5,
user:'Tommy Maintz',
leaf:true,
iconCls:'task'
},{
task:'Paint bedroom',
duration: 2.75,
user:'Tommy Maintz',
iconCls:'task-folder',
children: [{
task: 'Ceiling',
duration: 1.25,
user: 'Tommy Maintz',
iconCls: 'task',
leaf: true
}, {
task: 'Walls',
duration: 1.5,
user: 'Tommy Maintz',
iconCls: 'task',
leaf: true
}]
},{
task:'Decorate living room',
duration:2.75,
user:'Tommy Maintz',
leaf:true,
iconCls:'task'
},{
task: 'Fix lights',
duration: .75,
user: 'Tommy Maintz',
leaf: true,
iconCls: 'task'
}, {
task: 'Reattach screen door',
duration: 2,
user: 'Tommy Maintz',
leaf: true,
iconCls: 'task'
}]
}]
}]
}