PDA

View Full Version : Error while closing tabs



amanind
14 Dec 2010, 12:41 AM
I am facing error while closing tabs.
I have 5 tabs and every tabs have 2 fieldsets under it.

there is no error when I close first tab

after on close of every tab it shows error : "Style" is null or not an object and on close of last tab, fieldset will remain on page, it will not distroy on close of last tab

Any clue what should be the problem

Thanks in advance

mankz
14 Dec 2010, 12:59 AM
Post code

amanind
14 Dec 2010, 1:55 AM
Here is my code

First class called to create tab, the other classes to create grid in fieldset



MS.ImpactSisterApp.FinancialProjectionsPanel = Ext.extend(Ext.Panel, {
dealDetailsInfo:null,
appInfoToolbar: null,
investmentId: null,
investmentName: null,
grid1: null,
grid2: null,

initComponent: function () {
this.appInfoToolbar = new Ext.Toolbar({
items: [{
xtype: 'label',
text: 'Deal Details'
}]
});
var dealDetails = this;

this.grid1 = new MS.ImpactSisterApp.DealInformation({ dealDetailsInfo : dealDetails });
this.grid2 = new MS.ImpactSisterApp.FinancialProjections({ dealDetailsInfo : dealDetails });
investmentId = this.financialProjection.data.Investment.Id;
investmentName = this.financialProjection.data.Investment.Name;
var config = {
tbar: this.appInfoToolbar,
title: investmentName,
investmentId: investmentId,
investmentName: investmentName+"FP",
autoScroll: true,
closable:true,
bodyStyle:'padding:5px 5px 0',
items: [{
xtype:'fieldset',
title: 'Deal Information',
collapsible: true,
autoWidth: true,
autoHeight:true,
items:[ this.grid1 ]
},{
xtype:'fieldset',
title: 'Financial Projections',
collapsible: true,
collapsed: false,
autoWidth: true,
autoHeight:true,
items:[ this.grid2 ]
}]
};
Ext.apply(this.initialConfig, config);
Ext.apply(this, config);
MS.ImpactSisterApp.FinancialProjectionsPanel.superclass.initComponent.apply(this, arguments);
},
onDestroy: function() {
this.dealDetailsInfo = null;
investmentId = null;
investmentName = null;
this.grid1 = null;
this.grid2 = null;
}
});
MS.ImpactSisterApp.DealInformation = Ext.extend(Ext.grid.GridPanel, {
initComponent: function () {
var mappings = [
['Fund', 'dealDetailsInfo.financialProjection.data.Investment.Fund.Name'],
['Business ID', 'dealDetailsInfo.financialProjection.data.Investment.BusinessId'],
['Country', 'dealDetailsInfo.financialProjection.data.Investment.Country.Name'],
['Region', 'dealDetailsInfo.financialProjection.data.Investment.Country.Region.Name'],
['Investment Type', 'dealDetailsInfo.financialProjection.data.Investment.PropertyType.Name'],
['Advisory Meeting Investment Type', 'dealDetailsInfo.financialProjection.data.Investment.AdvisoryMeetingInvestmentType.Name'],
['Investment Status', 'dealDetailsInfo.financialProjection.data.Investment.InvestmentStatus'],
['Waterfall Type', 'dealDetailsInfo.financialProjection.data.Investment.IsSystemWaterfall'],
['Original Acquistion Date', 'dealDetailsInfo.financialProjection.data.Investment.OriginalAcquisitionDate'],
['Committed Close Date', 'dealDetailsInfo.financialProjection.data.Investment.CommitedClosedDate'],
['Final Asset Disposition Date', 'dealDetailsInfo.financialProjection.data.Investment.FinalAssetDispositionDate'],
['Official Closing Date', 'dealDetailsInfo.financialProjection.data.Investment.OfficialClosingDate']
];
for (var i = 0; i < mappings.length; i++) {
var mapping = mappings[i];
for (var j = 1; j < 2; j++) {
mapping[j] = Ext.data.JsonReader.prototype.getJsonAccessor.call(null, mapping[j]);
}
//mapping[2] = mapping[2] == 'Y' ? -1 : 1;
}
this.store = new Ext.data.JsonStore({
fields: ['company', 'fundLC']
});

this.store.reader.readRecords = function (o) {
o = {
dealDetailsInfo: o.dealDetailsInfo || {}
};
var records = [];
for (var i = 0; i < mappings.length; i++) {
var mapping = mappings[i];
records.push(new this.recordType({
company: mapping[0],
fundLC: (mapping[1](o) || '')
}));
}
// console.log(records);
return {
success: true,
records: records,
totalRecords: records.length
};
};
var config = {
store: this.store,
columns: [{
id: 'company',
width: 250,
sortable: false,
dataIndex: 'company'
},
{
width: 250,
sortable: false,
align: 'left',
renderer: this.fundLC,
dataIndex: 'fundLC'
}],
stripeRows: true,
enableHdMenu: false,
enableColumnMove: false,
enableColumnResize: false,
autoExpandColumn: 'company',
height: 280,
width: 900
};
Ext.apply(this.initialConfig, config);
Ext.apply(this, config);
MS.ImpactSisterApp.DealInformation.superclass.initComponent.apply(this, arguments);
if(this.dealDetailsInfo.financialProjection.data.Investment.IsSystemWaterfall == true){
this.dealDetailsInfo.financialProjection.data.Investment.IsSystemWaterfall = "System";
} else {
this.dealDetailsInfo.financialProjection.data.Investment.IsSystemWaterfall = "Excel";
}
this.store.loadData(this);
},
fundLC: function (value) {
if(isNaN(value)){
if(value.indexOf('Date') != -1){
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
return value;
}
} else {
if(value == "true"){
value = "System";
return value;
} else if(value == "false"){
value = "Excel";
return value;
} else {
return value;
}
}
}
});
MS.ImpactSisterApp.FinancialProjections = Ext.extend(Ext.grid.EditorGridPanel, {
reportingPeriodData:null,
gridToolbar: null,
repPeriodCombo:null,
financialProjection: null,
dealDetailsInfo: null,
invId: null,
iFlag: 1,

initComponent: function () {
//MS.ImpactSisterApp.SisterAppEventManager.fireEvent("getReportingPeriods", {"method": "getReportingPeriods"});
//InvId = this.dealDetailsInfo.financialProjection.data.Investment.Id;
repPeriodCombo = new MS.ImpactSisterApp.ReportingPeriodCombo({ reportingPeriodData: this.dealDetailsInfo.reportingPeriods.data });
MS.ImpactSisterApp.SisterAppEventManager.on("reportingPeriodComboChanged", this.reLoadGrid, this);
MS.ImpactSisterApp.SisterAppEventManager.on("loadFinancialSet", this.reLoadFinancial, this);
this.gridToolbar = new Ext.Toolbar({
items: [
{
xtype: 'label',
style:'padding: 0 6px',
text: 'Reporting Period: '
},
repPeriodCombo,
{
xtype: 'hidden',
name: 'hiddebReportingPeriod',
id: 'hiddebReportingPeriod'
},
{
xtype: 'hidden',
name: 'recordsHidden',
id: 'recordsHidden'
}
]
});

var mappings = [
['Investment Level %', 'financialProjection.data.InvLeveIIrrPerInvCommBook', 'financialProjection.data.InvLevelEqtyMultiplePerInvCommBook', 'financialProjection.data.InvLeveIIrrPerFinUndWrit', 'financialProjection.data.InvLevelEqtyMultiplePerFinUndWrit'],
['MSREF USD Gross(Before MS Feed & Promote/After Currency Hedging)(%)', 'financialProjection.data.IrrBefFeesAftHedPerInvCommBookUsd', 'financialProjection.data.EqMulBefFeesAftHedPerInvCommBookUsd', 'financialProjection.data.IrrBefFeesAftHedPerFinUndWritUsd', 'financialProjection.data.EqMulBefFeesAftHedPerFinUndWritUsd'],
['MSREF LC Gross(Before MS Feed & Promote/After Currency Hedging)(%)', 'financialProjection.data.IrrBefFeesBefHedPerInvCommBookLc', 'financialProjection.data.EqMulBefFeesBefHedPerInvCommBookLc', 'financialProjection.data.IrrBefFeesBefHedPerFinUndWritLc', 'financialProjection.data.EqMulBefFeesBefHedPerFinUndWritLc'],
['MSREF Net(Before MS Feed & Promote/After Currency Hedging)(%)', 'financialProjection.data.NetIrrAftFeesAftHedPerInvCommBook', 'financialProjection.data.NetEqMulAftFeesAftHedPerInvCommBook', 'financialProjection.data.NetIrrAftFeesAftHedPerFinUndWrit', 'financialProjection.data.NetEqMulAftFeesAftHedPerFinUndWrit'],
['Exit Date', 'financialProjection.data.ExitDatePerInvCommBook', '', 'financialProjection.data.ExitDatePerFinUndWrit', ''],
['Investment Committee Approved Allocation($)', 'financialProjection.data.InvCommAppAllocPerInvCommBook', '', 'financialProjection.data.InvCommAppAllocPerFinUndWrit', ''],
['General Comments', 'financialProjection.data.GeneralComments']
];
for (var i = 0; i < mappings.length; i++) {
var mapping = mappings[i];
for (var j = 1; j < 5; j++) {
mapping[j] = Ext.data.JsonReader.prototype.getJsonAccessor.call(null, mapping[j]);
}
//mapping[5] = mapping[5] == 'Y' ? -1 : 1;
}
//var rowEditor = new Ext.ux.grid.RowEditor();
this.store = new Ext.data.JsonStore({
fields: ['investment', 'column1', 'column2', 'column3', 'column4']
});
this.store.reader.readRecords = function (o) {
o = {
financialProjection: o.financialProjection || {}
};
var records = [];
for (var i = 0; i < mappings.length; i++) {
var mapping = mappings[i];
records.push(new this.recordType({
investment: mapping[0],
column1: (mapping[1](o) || ''),
column2: (mapping[2](o) || ''),
column3: (mapping[3](o) || ''),
column4: (mapping[4](o) || '')
}));
}
// console.log(records);
return {
success: true,
records: records,
totalRecords: records.length
};
};
var colModel = new Ext.grid.ColumnModel({
columns: [{
id: 'investment',
header: '',
width: 460,
sortable: false,
dataIndex: 'investment'
},
{
header: 'IRR',
width: 110,
sortable: false,
align: 'right',
viewConfig: {
enableRowBody: true
},
renderer: this.column1,
editor : new Ext.form.NumberField({
disabled: true,
id:'msrefUSDText'+this.dealDetailsInfo.financialProjection.data.Investment.Id
}),
dataIndex: 'column1'
},
{
header: 'Equity Multiple',
width: 110,
sortable: false,
align: 'right',
renderer: this.column2,
editor : new Ext.form.NumberField({
disabled: true,
id:'msrefNETText'+this.dealDetailsInfo.financialProjection.data.Investment.Id
}),
dataIndex: 'column2'
},
{
header: 'IRR',
width: 110,
sortable: false,
align: 'right',
renderer: this.column3,
editor : new Ext.form.NumberField({
disabled: true,
id:'exitDateText'+this.dealDetailsInfo.financialProjection.data.Investment.Id
}),
dataIndex: 'column3'
},
{
header: 'Equity Multiple',
width: 110,
sortable: false,
align: 'right',
renderer: this.column4,
editor : new Ext.form.NumberField({
disabled: true,
id:'generalCText'+this.dealDetailsInfo.financialProjection.data.Investment.Id
}),
dataIndex: 'column4'
}],
editors: {
'text': new Ext.grid.GridEditor(new Ext.form.TextArea({
width : 250,
disabled : true,
align: 'left',
id: 'textarea'+this.dealDetailsInfo.financialProjection.data.Investment.Id})),
'number': new Ext.grid.GridEditor(new Ext.form.NumberField({ disabled: true })),
'date': new Ext.grid.GridEditor(new Ext.form.DateField({ disabled : true, id:'dateFieldId'+this.dealDetailsInfo.financialProjection.data.Investment.Id, renderer : Ext.util.Format.dateRenderer('m/d/Y') }))
},
getCellEditor: function(colIndex, rowIndex) {
var field = this.getDataIndex(colIndex);
if(rowIndex == 1 && (colIndex == 3 || colIndex == 4)){
return this.editors['number'];
}
if(rowIndex == 4 && (colIndex == 2 || colIndex == 4)){
return this.editors['number'];
}
if(rowIndex == 5 && (colIndex == 2 || colIndex == 4)){
return this.editors['number'];
}
if(rowIndex == 6 && (colIndex == 1)){
return this.editors['text'];
}
if(rowIndex == 6 && (colIndex == 2 || colIndex == 3 || colIndex == 4)){
return this.editors['number'];
}
//if(Ext.getCmp('saveBtn').enabled){
if(rowIndex == 4 && (colIndex == 1 || colIndex == 3)){
//var rec = store.getAt(rowIndex);
//Ext.grid.ColumnModel.setRenderer(colIndex, this.formatDate);
return this.editors['date'];
}
//}
return Ext.grid.ColumnModel.prototype.getCellEditor.call(this, colIndex, rowIndex);
}
});


var config = {
frame: true,
hideBorders: true,
timeout: 60000,
header: false,
layout: 'table',
tbar: this.gridToolbar,
layoutConfig: {
columns: 2
},
buttonAlign: 'right',
buttons: [
{
text: 'Edit',
id: 'editBtn'+this.dealDetailsInfo.financialProjection.data.Investment.Id,
handler: function() {
invId = this.initialConfig.id.split('Btn')[1];
Ext.getCmp('saveBtn'+invId).enable().enabled = true;
Ext.getCmp('cancelBtn'+invId).enable().enabled = true;
Ext.getCmp('editBtn'+invId).disable();

Ext.getCmp('msrefUSDText'+invId).enable().enabled = true;
Ext.getCmp('textarea'+invId).enable().enabled = true;
Ext.getCmp('msrefNETText'+invId).enable().enabled = true;
Ext.getCmp('exitDateText'+invId).enable().enabled = true;
Ext.getCmp('generalCText'+invId).enable().enabled = true;
Ext.getCmp('dateFieldId'+invId).enable().enabled = true;
//onStartEditing();
}
},{
text: 'Save',
id: 'saveBtn'+this.dealDetailsInfo.financialProjection.data.Investment.Id,
disabled: true,
handler: function(fbtn) {
var grid = fbtn.findParentByType();
var records = grid.getStore().getRange();
var a = "";
var b = "";
if(records[4].data.column1 != ""){
var value = records[4].data.column1;
if(isNaN(value)){
if(value.indexOf('Date') != -1){
var val = MS.ImpactSisterApp.convertToDate(value);
a = (new Date(val)).format('m/d/Y');
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
a = (new Date(value)).format('m/d/Y');
}
}
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
a = (new Date(value)).format('m/d/Y');
}
}
}
if(records[4].data.column3 != ""){
var value = records[4].data.column3;
if(isNaN(value)){
if(value.indexOf('Date') != -1){
var val = MS.ImpactSisterApp.convertToDate(value);
b = (new Date(val)).format('m/d/Y');
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
b = (new Date(value)).format('m/d/Y');
}
}
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
b = (new Date(value)).format('m/d/Y');
}
}
}
parStr = records[0].data.column1;
parStr += "&" + records[0].data.column2;
parStr += "&" + records[0].data.column3;
parStr += "&" + records[0].data.column4;
parStr += "&" + records[1].data.column1;
parStr += "&" + records[1].data.column2;
parStr += "&" + records[2].data.column1;
parStr += "&" + records[2].data.column2;
parStr += "&" + records[2].data.column3;
parStr += "&" + records[2].data.column4;
parStr += "&" + records[3].data.column1;
parStr += "&" + records[3].data.column2;
parStr += "&" + records[3].data.column3;
parStr += "&" + records[3].data.column4;
parStr += "&" + a;
parStr += "&" + b;
parStr += "&" + records[5].data.column1;
parStr += "&" + records[5].data.column3;
parStr += "&" + records[6].data.column1;
parStr += "&" + grid.dealDetailsInfo.investmentId;
parStr += "&" + repPeriodCombo.selectedItem.ReportingPeriodId;

Ext.getCmp('recordsHidden').el.dom.value = parStr;

Ext.MessageBox.confirm('Confirm', 'Are you sure you want to save changes?', showResult);

invId = this.initialConfig.id.split('Btn')[1];
Ext.getCmp('saveBtn'+invId).disable();
Ext.getCmp('cancelBtn'+invId).disable();
Ext.getCmp('editBtn'+invId).enable().enabled = true;
Ext.getCmp('msrefUSDText'+invId).disable();
Ext.getCmp('textarea'+invId).disable();
Ext.getCmp('msrefNETText'+invId).disable();
Ext.getCmp('exitDateText'+invId).disable();
Ext.getCmp('generalCText'+invId).disable();
Ext.getCmp('dateFieldId'+invId).disable();
Ext.getCmp('saveBtn'+invId).enabled = false;
}
},
{
text: 'Cancel',
id: 'cancelBtn'+this.dealDetailsInfo.financialProjection.data.Investment.Id,
disabled: true,
handler: function() {
invId = this.initialConfig.id.split('Btn')[1];
Ext.getCmp('saveBtn'+invId).disable();
Ext.getCmp('cancelBtn'+invId).disable();
Ext.getCmp('editBtn'+invId).enable().enabled = true;
Ext.getCmp('msrefUSDText'+invId).disable();
Ext.getCmp('textarea'+invId).disable();
Ext.getCmp('msrefNETText'+invId).disable();
Ext.getCmp('exitDateText'+invId).disable();
Ext.getCmp('generalCText'+invId).disable();
Ext.getCmp('dateFieldId'+invId).disable();
Ext.getCmp('saveBtn'+invId).enabled = false;
}
}],
id: 'columnStruct',
store: this.store,
clicksToEdit :1,
cm: colModel,
stripeRows: true,
enableHdMenu: false,
enableColumnMove: false,
enableColumnResize: false,
autoExpandColumn: 'investment',
height: 280,
width: 900,
plugins: [
new Ext.ux.grid.ColumnHeaderGroup({
rows: [
[{
// no header
},
{
header: '(Per Investment Committee Book)',
align: 'center',
colspan: 2
},
{
header: '(Per Final Underwriting/Magic Page)',
align: 'center',
colspan: 2
}]
]
})
]
};
Ext.apply(this.initialConfig, config);
Ext.apply(this, config);
MS.ImpactSisterApp.FinancialProjections.superclass.initComponent.apply(this, arguments);
repPeriodCombo.on("select", this.reLoadGrid, this);
//this.on('cellclick', this.onStartEditing, this);

this.store.loadData(this.dealDetailsInfo);
},
onStartEditing: function(grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex); // Get the Record
var fieldName = grid.getColumnModel().getCellEditor(columnIndex); // Get field name
var data = record.get(fieldName);
if(rowIndex == 3 && (columnIndex == 1 || columnIndex == 3)){
record.set(fieldName, "");
}
},
reLoadGrid: function(val){
MS.ImpactSisterApp.ShowLoadingMask(true);
iFlag = 0;
Ext.getCmp('hiddebReportingPeriod').el.dom.value = val.selectedItem.ReportingPeriodId;
var params = { method: "getFinancialProjection", event:"reLoadFinancial", investmentId: this.dealDetailsInfo.financialProjection.data.Investment.Id, reportingPeriodId: val.selectedItem.ReportingPeriodId }
MS.ImpactSisterApp.SisterAppEventManager.fireEvent('getFinancialProjection', params);
},
reLoadFinancial: function(val){
var grid = this.findParentByType().financialProjection;
if(iFlag == 0 && (this.dealDetailsInfo.investmentId == val.financialProjection.data.Investment.Id)){
iFlag = 1;
this.store.loadData(val);

var selectedReportingId = Ext.getCmp('hiddebReportingPeriod').el.dom.value;
for(var i=0; i<this.dealDetailsInfo.reportingPeriods.data.length; i++){
if (this.dealDetailsInfo.reportingPeriods.data[i].Status.Id == "C") {
var currentReportingid = this.dealDetailsInfo.reportingPeriods.data[i].ReportingPeriodId;
invId = this.initialConfig.dealDetailsInfo.financialProjection.data.Investment.Id;
if(currentReportingid > selectedReportingId){
Ext.getCmp('editBtn'+invId).disable().disabled = true;
Ext.getCmp('saveBtn'+invId).disable().disabled = true;
Ext.getCmp('cancelBtn'+invId).disable().disabled = true;
} else {
Ext.getCmp('editBtn'+invId).enable().enabled = true;
Ext.getCmp('saveBtn'+invId).disable().disabled = true;
Ext.getCmp('cancelBtn'+invId).disable().disabled = true;
}
}
}
Ext.getCmp('hiddebReportingPeriod').el.dom.value = "";
}
},
column1: function (value, grid, record) {
if(value == "" && record.data.investment == "Exit Date" && record.modified != null){
if(record.modified.column1 == "" || record.modified.column1 == null){
return;
} else {
value = record.modified.column1;
}
if(value.indexOf('Date') != -1){
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
} else {
if(isNaN(value)){
if(value.indexOf('Date') != -1){
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
return (new Date(value)).format('m/d/Y');
} else {
if(record.data.investment == "General Comments"){

}
return value;
}
}
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
}
},
column2: function (value) {
if(value == ''){
return value;
} else {
return value;
}
},
column3: function (value, grid, record) {
if(value == "" && record.data.investment == "Exit Date" && record.modified != null){
if(record.modified.column3 == "" || record.modified.column3 == null){
return;
} else {
value = record.modified.column3;
}
if(value.indexOf('Date') != -1){
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
} else {
if(isNaN(value)){
if(value.indexOf('Date') != -1){
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
} else {
if((typeof(value)==='date')?true:(typeof(value)==='object')?value.constructor.toString().match(/date/i)!==null:false){
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
}
},
column4: function (value) {
if(value == ''){
return value;
} else {
return value;
}
},

onDestroy: function() {
this.dealDetailsInfo = null;
this.gridToolbar = null;
invId = null;
repPeriodCombo.un("select", this.reLoadGrid, this);
MS.ImpactSisterApp.SisterAppEventManager.un("reportingPeriodComboChanged", this.reLoadGrid, this);
MS.ImpactSisterApp.SisterAppEventManager.un("loadFinancialSet", this.reLoadFinancial, this);
}
});
function showResult(btn) {
if(btn == 'yes'){
var parstr = Ext.getCmp('recordsHidden').el.dom.value;
parstr = parstr.split('&');
Ext.getCmp('recordsHidden').el.dom.value = "";
MS.ImpactSisterApp.SisterAppEventManager.fireEvent("saveFinancialProjection", { "method": "saveFinancialProjection", "investmentId": parstr[19], "reportingPeriodId": parstr[20], "InvLeveIIrrPerInvCommBook": parstr[0], "InvLevelEqtyMultiplePerInvCommBook" : parstr[1], "InvLeveIIrrPerFinUndWrit": parstr[2], "InvLevelEqtyMultiplePerFinUndWrit" : parstr[3], "IrrBefFeesAftHedPerInvCommBookUsd": parstr[4], "EqMulBefFeesAftHedPerInvCommBookUsd": parstr[5], "IrrBefFeesBefHedPerInvCommBookLc": parstr[6], "EqMulBefFeesBefHedPerInvCommBookLc": parstr[7], "IrrBefFeesBefHedPerFinUndWritLc": parstr[8], "EqMulBefFeesBefHedPerFinUndWritLc" : parstr[9], "NetIrrAftFeesAftHedPerInvCommBook": parstr[10], "NetEqMulAftFeesAftHedPerInvCommBook": parstr[11], "NetIrrAftFeesAftHedPerFinUndWrit": parstr[12], "NetEqMulAftFeesAftHedPerFinUndWrit": parstr[13], "ExitDatePerInvCommBook" : parstr[14], "ExitDatePerFinUndWrit": parstr[15], "InvCommAppAllocPerInvCommBook": parstr[16], "InvCommAppAllocPerFinUndWrit": parstr[17], "GeneralComments": parstr[18] });
}
}

Condor
14 Dec 2010, 2:27 AM
Please post properly indented code (try jsbeautifier.org):

MS.ImpactSisterApp.FinancialProjectionsPanel = Ext.extend(Ext.Panel, {
dealDetailsInfo: null,
appInfoToolbar: null,
investmentId: null,
investmentName: null,
grid1: null,
grid2: null,
initComponent: function () {
this.appInfoToolbar = new Ext.Toolbar({
items: [{
xtype: 'label',
text: 'Deal Details'
}]
});
var dealDetails = this;
this.grid1 = new MS.ImpactSisterApp.DealInformation({
dealDetailsInfo: dealDetails
});
this.grid2 = new MS.ImpactSisterApp.FinancialProjections({
dealDetailsInfo: dealDetails
});
investmentId = this.financialProjection.data.Investment.Id;
investmentName = this.financialProjection.data.Investment.Name;
var config = {
tbar: this.appInfoToolbar,
title: investmentName,
investmentId: investmentId,
investmentName: investmentName + "FP",
autoScroll: true,
closable: true,
bodyStyle: 'padding:5px 5px 0',
items: [{
xtype: 'fieldset',
title: 'Deal Information',
collapsible: true,
autoWidth: true,
autoHeight: true,
items: [this.grid1]
},
{
xtype: 'fieldset',
title: 'Financial Projections',
collapsible: true,
collapsed: false,
autoWidth: true,
autoHeight: true,
items: [this.grid2]
}]
};
Ext.apply(this.initialConfig, config);
Ext.apply(this, config);
MS.ImpactSisterApp.FinancialProjectionsPanel.superclass.initComponent.apply(this, arguments);
},
onDestroy: function () {
this.dealDetailsInfo = null;
investmentId = null;
investmentName = null;
this.grid1 = null;
this.grid2 = null;
}
});
MS.ImpactSisterApp.DealInformation = Ext.extend(Ext.grid.GridPanel, {
initComponent: function () {
var mappings = [
['Fund', 'dealDetailsInfo.financialProjection.data.Investment.Fund.Name'],
['Business ID', 'dealDetailsInfo.financialProjection.data.Investment.BusinessId'],
['Country', 'dealDetailsInfo.financialProjection.data.Investment.Country.Name'],
['Region', 'dealDetailsInfo.financialProjection.data.Investment.Country.Region.Name'],
['Investment Type', 'dealDetailsInfo.financialProjection.data.Investment.PropertyType.Name'],
['Advisory Meeting Investment Type', 'dealDetailsInfo.financialProjection.data.Investment.AdvisoryMeetingInvestmentType.Name'],
['Investment Status', 'dealDetailsInfo.financialProjection.data.Investment.InvestmentStatus'],
['Waterfall Type', 'dealDetailsInfo.financialProjection.data.Investment.IsSystemWaterfall'],
['Original Acquistion Date', 'dealDetailsInfo.financialProjection.data.Investment.OriginalAcquisitionDate'],
['Committed Close Date', 'dealDetailsInfo.financialProjection.data.Investment.CommitedClosedDate'],
['Final Asset Disposition Date', 'dealDetailsInfo.financialProjection.data.Investment.FinalAssetDispositionDate'],
['Official Closing Date', 'dealDetailsInfo.financialProjection.data.Investment.OfficialClosingDate']
];
for (var i = 0; i < mappings.length; i++) {
var mapping = mappings[i];
for (var j = 1; j < 2; j++) {
mapping[j] = Ext.data.JsonReader.prototype.getJsonAccessor.call(null, mapping[j]);
}
//mapping[2] = mapping[2] == 'Y' ? -1 : 1;
}
this.store = new Ext.data.JsonStore({
fields: ['company', 'fundLC']
});
this.store.reader.readRecords = function (o) {
o = {
dealDetailsInfo: o.dealDetailsInfo || {}
};
var records = [];
for (var i = 0; i < mappings.length; i++) {
var mapping = mappings[i];
records.push(newthis.recordType({
company: mapping[0],
fundLC: (mapping[1](o) || '')
}));
}
// console.log(records);
return {
success: true,
records: records,
totalRecords: records.length
};
};
var config = {
store: this.store,
columns: [{
id: 'company',
width: 250,
sortable: false,
dataIndex: 'company'
},
{
width: 250,
sortable: false,
align: 'left',
renderer: this.fundLC,
dataIndex: 'fundLC'
}],
stripeRows: true,
enableHdMenu: false,
enableColumnMove: false,
enableColumnResize: false,
autoExpandColumn: 'company',
height: 280,
width: 900
};
Ext.apply(this.initialConfig, config);
Ext.apply(this, config);
MS.ImpactSisterApp.DealInformation.superclass.initComponent.apply(this, arguments);
if (this.dealDetailsInfo.financialProjection.data.Investment.IsSystemWaterfall == true) {
this.dealDetailsInfo.financialProjection.data.Investment.IsSystemWaterfall = "System";
} else {
this.dealDetailsInfo.financialProjection.data.Investment.IsSystemWaterfall = "Excel";
}
this.store.loadData(this);
},
fundLC: function (value) {
if (isNaN(value)) {
if (value.indexOf('Date') != -1) {
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
return value;
}
} else {
if (value == "true") {
value = "System";
return value;
}
elseif(value == "false") {
value = "Excel";
return value;
} else {
return value;
}
}
}
});
MS.ImpactSisterApp.FinancialProjections = Ext.extend(Ext.grid.EditorGridPanel, {
reportingPeriodData: null,
gridToolbar: null,
repPeriodCombo: null,
financialProjection: null,
dealDetailsInfo: null,
invId: null,
iFlag: 1,
initComponent: function () {
//MS.ImpactSisterApp.SisterAppEventManager.fireEvent("getReportingPeriods", {"method": "getReportingPeriods"});
//InvId = this.dealDetailsInfo.financialProjection.data.Investment.Id;
repPeriodCombo = new MS.ImpactSisterApp.ReportingPeriodCombo({
reportingPeriodData: this.dealDetailsInfo.reportingPeriods.data
});
MS.ImpactSisterApp.SisterAppEventManager.on("reportingPeriodComboChanged", this.reLoadGrid, this);
MS.ImpactSisterApp.SisterAppEventManager.on("loadFinancialSet", this.reLoadFinancial, this);
this.gridToolbar = new Ext.Toolbar({
items: [{
xtype: 'label',
style: 'padding: 0 6px',
text: 'Reporting Period: '
},
repPeriodCombo,
{
xtype: 'hidden',
name: 'hiddebReportingPeriod',
id: 'hiddebReportingPeriod'
},
{
xtype: 'hidden',
name: 'recordsHidden',
id: 'recordsHidden'
}]
});
var mappings = [
['Investment Level %', 'financialProjection.data.InvLeveIIrrPerInvCommBook', 'financialProjection.data.InvLevelEqtyMultiplePerInvCommBook', 'financialProjection.data.InvLeveIIrrPerFinUndWrit', 'financialProjection.data.InvLevelEqtyMultiplePerFinUndWrit'],
['MSREF USD Gross(Before MS Feed & Promote/After Currency Hedging)(%)', 'financialProjection.data.IrrBefFeesAftHedPerInvCommBookUsd', 'financialProjection.data.EqMulBefFeesAftHedPerInvCommBookUsd', 'financialProjection.data.IrrBefFeesAftHedPerFinUndWritUsd', 'financialProjection.data.EqMulBefFeesAftHedPerFinUndWritUsd'],
['MSREF LC Gross(Before MS Feed & Promote/After Currency Hedging)(%)', 'financialProjection.data.IrrBefFeesBefHedPerInvCommBookLc', 'financialProjection.data.EqMulBefFeesBefHedPerInvCommBookLc', 'financialProjection.data.IrrBefFeesBefHedPerFinUndWritLc', 'financialProjection.data.EqMulBefFeesBefHedPerFinUndWritLc'],
['MSREF Net(Before MS Feed & Promote/After Currency Hedging)(%)', 'financialProjection.data.NetIrrAftFeesAftHedPerInvCommBook', 'financialProjection.data.NetEqMulAftFeesAftHedPerInvCommBook', 'financialProjection.data.NetIrrAftFeesAftHedPerFinUndWrit', 'financialProjection.data.NetEqMulAftFeesAftHedPerFinUndWrit'],
['Exit Date', 'financialProjection.data.ExitDatePerInvCommBook', '', 'financialProjection.data.ExitDatePerFinUndWrit', ''],
['Investment Committee Approved Allocation($)', 'financialProjection.data.InvCommAppAllocPerInvCommBook', '', 'financialProjection.data.InvCommAppAllocPerFinUndWrit', ''],
['General Comments', 'financialProjection.data.GeneralComments']
];
for (var i = 0; i < mappings.length; i++) {
var mapping = mappings[i];
for (var j = 1; j < 5; j++) {
mapping[j] = Ext.data.JsonReader.prototype.getJsonAccessor.call(null, mapping[j]);
}
//mapping[5] = mapping[5] == 'Y' ? -1 : 1;
}
//var rowEditor = new Ext.ux.grid.RowEditor();
this.store = new Ext.data.JsonStore({
fields: ['investment', 'column1', 'column2', 'column3', 'column4']
});
this.store.reader.readRecords = function (o) {
o = {
financialProjection: o.financialProjection || {}
};
var records = [];
for (var i = 0; i < mappings.length; i++) {
var mapping = mappings[i];
records.push(newthis.recordType({
investment: mapping[0],
column1: (mapping[1](o) || ''),
column2: (mapping[2](o) || ''),
column3: (mapping[3](o) || ''),
column4: (mapping[4](o) || '')
}));
}
// console.log(records);
return {
success: true,
records: records,
totalRecords: records.length
};
};
var colModel = new Ext.grid.ColumnModel({
columns: [{
id: 'investment',
header: '',
width: 460,
sortable: false,
dataIndex: 'investment'
},
{
header: 'IRR',
width: 110,
sortable: false,
align: 'right',
viewConfig: {
enableRowBody: true
},
renderer: this.column1,
editor: new Ext.form.NumberField({
disabled: true,
id: 'msrefUSDText' + this.dealDetailsInfo.financialProjection.data.Investment.Id
}),
dataIndex: 'column1'
},
{
header: 'Equity Multiple',
width: 110,
sortable: false,
align: 'right',
renderer: this.column2,
editor: new Ext.form.NumberField({
disabled: true,
id: 'msrefNETText' + this.dealDetailsInfo.financialProjection.data.Investment.Id
}),
dataIndex: 'column2'
},
{
header: 'IRR',
width: 110,
sortable: false,
align: 'right',
renderer: this.column3,
editor: new Ext.form.NumberField({
disabled: true,
id: 'exitDateText' + this.dealDetailsInfo.financialProjection.data.Investment.Id
}),
dataIndex: 'column3'
},
{
header: 'Equity Multiple',
width: 110,
sortable: false,
align: 'right',
renderer: this.column4,
editor: new Ext.form.NumberField({
disabled: true,
id: 'generalCText' + this.dealDetailsInfo.financialProjection.data.Investment.Id
}),
dataIndex: 'column4'
}],
editors: {
'text': new Ext.grid.GridEditor(new Ext.form.TextArea({
width: 250,
disabled: true,
align: 'left',
id: 'textarea' + this.dealDetailsInfo.financialProjection.data.Investment.Id
})),
'number': new Ext.grid.GridEditor(new Ext.form.NumberField({
disabled: true
})),
'date': new Ext.grid.GridEditor(new Ext.form.DateField({
disabled: true,
id: 'dateFieldId' + this.dealDetailsInfo.financialProjection.data.Investment.Id,
renderer: Ext.util.Format.dateRenderer('m/d/Y')
}))
},
getCellEditor: function (colIndex, rowIndex) {
var field = this.getDataIndex(colIndex);
if (rowIndex == 1 && (colIndex == 3 || colIndex == 4)) {
returnthis.editors['number'];
}
if (rowIndex == 4 && (colIndex == 2 || colIndex == 4)) {
returnthis.editors['number'];
}
if (rowIndex == 5 && (colIndex == 2 || colIndex == 4)) {
returnthis.editors['number'];
}
if (rowIndex == 6 && (colIndex == 1)) {
returnthis.editors['text'];
}
if (rowIndex == 6 && (colIndex == 2 || colIndex == 3 || colIndex == 4)) {
returnthis.editors['number'];
}
//if(Ext.getCmp('saveBtn').enabled){
if (rowIndex == 4 && (colIndex == 1 || colIndex == 3)) {
//var rec = store.getAt(rowIndex);
//Ext.grid.ColumnModel.setRenderer(colIndex, this.formatDate);
returnthis.editors['date'];
}
//}
return Ext.grid.ColumnModel.prototype.getCellEditor.call(this, colIndex, rowIndex);
}
});
var config = {
frame: true,
hideBorders: true,
timeout: 60000,
header: false,
layout: 'table',
tbar: this.gridToolbar,
layoutConfig: {
columns: 2
},
buttonAlign: 'right',
buttons: [{
text: 'Edit',
id: 'editBtn' + this.dealDetailsInfo.financialProjection.data.Investment.Id,
handler: function () {
invId = this.initialConfig.id.split('Btn')[1];
Ext.getCmp('saveBtn' + invId).enable().enabled = true;
Ext.getCmp('cancelBtn' + invId).enable().enabled = true;
Ext.getCmp('editBtn' + invId).disable();
Ext.getCmp('msrefUSDText' + invId).enable().enabled = true;
Ext.getCmp('textarea' + invId).enable().enabled = true;
Ext.getCmp('msrefNETText' + invId).enable().enabled = true;
Ext.getCmp('exitDateText' + invId).enable().enabled = true;
Ext.getCmp('generalCText' + invId).enable().enabled = true;
Ext.getCmp('dateFieldId' + invId).enable().enabled = true;
//onStartEditing();
}
},
{
text: 'Save',
id: 'saveBtn' + this.dealDetailsInfo.financialProjection.data.Investment.Id,
disabled: true,
handler: function (fbtn) {
var grid = fbtn.findParentByType();
var records = grid.getStore().getRange();
var a = "";
var b = "";
if (records[4].data.column1 != "") {
var value = records[4].data.column1;
if (isNaN(value)) {
if (value.indexOf('Date') != -1) {
var val = MS.ImpactSisterApp.convertToDate(value);
a = (new Date(val)).format('m/d/Y');
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
a = (new Date(value)).format('m/d/Y');
}
}
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
a = (new Date(value)).format('m/d/Y');
}
}
}
if (records[4].data.column3 != "") {
var value = records[4].data.column3;
if (isNaN(value)) {
if (value.indexOf('Date') != -1) {
var val = MS.ImpactSisterApp.convertToDate(value);
b = (new Date(val)).format('m/d/Y');
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
b = (new Date(value)).format('m/d/Y');
}
}
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
b = (new Date(value)).format('m/d/Y');
}
}
}
parStr = records[0].data.column1;
parStr += "&" + records[0].data.column2;
parStr += "&" + records[0].data.column3;
parStr += "&" + records[0].data.column4;
parStr += "&" + records[1].data.column1;
parStr += "&" + records[1].data.column2;
parStr += "&" + records[2].data.column1;
parStr += "&" + records[2].data.column2;
parStr += "&" + records[2].data.column3;
parStr += "&" + records[2].data.column4;
parStr += "&" + records[3].data.column1;
parStr += "&" + records[3].data.column2;
parStr += "&" + records[3].data.column3;
parStr += "&" + records[3].data.column4;
parStr += "&" + a;
parStr += "&" + b;
parStr += "&" + records[5].data.column1;
parStr += "&" + records[5].data.column3;
parStr += "&" + records[6].data.column1;
parStr += "&" + grid.dealDetailsInfo.investmentId;
parStr += "&" + repPeriodCombo.selectedItem.ReportingPeriodId;
Ext.getCmp('recordsHidden').el.dom.value = parStr;
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to save changes?', showResult);
invId = this.initialConfig.id.split('Btn')[1];
Ext.getCmp('saveBtn' + invId).disable();
Ext.getCmp('cancelBtn' + invId).disable();
Ext.getCmp('editBtn' + invId).enable().enabled = true;
Ext.getCmp('msrefUSDText' + invId).disable();
Ext.getCmp('textarea' + invId).disable();
Ext.getCmp('msrefNETText' + invId).disable();
Ext.getCmp('exitDateText' + invId).disable();
Ext.getCmp('generalCText' + invId).disable();
Ext.getCmp('dateFieldId' + invId).disable();
Ext.getCmp('saveBtn' + invId).enabled = false;
}
},
{
text: 'Cancel',
id: 'cancelBtn' + this.dealDetailsInfo.financialProjection.data.Investment.Id,
disabled: true,
handler: function () {
invId = this.initialConfig.id.split('Btn')[1];
Ext.getCmp('saveBtn' + invId).disable();
Ext.getCmp('cancelBtn' + invId).disable();
Ext.getCmp('editBtn' + invId).enable().enabled = true;
Ext.getCmp('msrefUSDText' + invId).disable();
Ext.getCmp('textarea' + invId).disable();
Ext.getCmp('msrefNETText' + invId).disable();
Ext.getCmp('exitDateText' + invId).disable();
Ext.getCmp('generalCText' + invId).disable();
Ext.getCmp('dateFieldId' + invId).disable();
Ext.getCmp('saveBtn' + invId).enabled = false;
}
}],
id: 'columnStruct',
store: this.store,
clicksToEdit: 1,
cm: colModel,
stripeRows: true,
enableHdMenu: false,
enableColumnMove: false,
enableColumnResize: false,
autoExpandColumn: 'investment',
height: 280,
width: 900,
plugins: [
new Ext.ux.grid.ColumnHeaderGroup({
rows: [
[{
// no header
},
{
header: '(Per Investment Committee Book)',
align: 'center',
colspan: 2
},
{
header: '(Per Final Underwriting/Magic Page)',
align: 'center',
colspan: 2
}]
]
})]
};
Ext.apply(this.initialConfig, config);
Ext.apply(this, config);
MS.ImpactSisterApp.FinancialProjections.superclass.initComponent.apply(this, arguments);
repPeriodCombo.on("select", this.reLoadGrid, this);
//this.on('cellclick', this.onStartEditing, this);
this.store.loadData(this.dealDetailsInfo);
},
onStartEditing: function (grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex); // Get the Record
var fieldName = grid.getColumnModel().getCellEditor(columnIndex); // Get field name
var data = record.get(fieldName);
if (rowIndex == 3 && (columnIndex == 1 || columnIndex == 3)) {
record.set(fieldName, "");
}
},
reLoadGrid: function (val) {
MS.ImpactSisterApp.ShowLoadingMask(true);
iFlag = 0;
Ext.getCmp('hiddebReportingPeriod').el.dom.value = val.selectedItem.ReportingPeriodId;
var params = {
method: "getFinancialProjection",
event: "reLoadFinancial",
investmentId: this.dealDetailsInfo.financialProjection.data.Investment.Id,
reportingPeriodId: val.selectedItem.ReportingPeriodId
}
MS.ImpactSisterApp.SisterAppEventManager.fireEvent('getFinancialProjection', params);
},
reLoadFinancial: function (val) {
var grid = this.findParentByType().financialProjection;
if (iFlag == 0 && (this.dealDetailsInfo.investmentId == val.financialProjection.data.Investment.Id)) {
iFlag = 1;
this.store.loadData(val);
var selectedReportingId = Ext.getCmp('hiddebReportingPeriod').el.dom.value;
for (var i = 0; i < this.dealDetailsInfo.reportingPeriods.data.length; i++) {
if (this.dealDetailsInfo.reportingPeriods.data[i].Status.Id == "C") {
var currentReportingid = this.dealDetailsInfo.reportingPeriods.data[i].ReportingPeriodId;
invId = this.initialConfig.dealDetailsInfo.financialProjection.data.Investment.Id;
if (currentReportingid > selectedReportingId) {
Ext.getCmp('editBtn' + invId).disable().disabled = true;
Ext.getCmp('saveBtn' + invId).disable().disabled = true;
Ext.getCmp('cancelBtn' + invId).disable().disabled = true;
} else {
Ext.getCmp('editBtn' + invId).enable().enabled = true;
Ext.getCmp('saveBtn' + invId).disable().disabled = true;
Ext.getCmp('cancelBtn' + invId).disable().disabled = true;
}
}
}
Ext.getCmp('hiddebReportingPeriod').el.dom.value = "";
}
},
column1: function (value, grid, record) {
if (value == "" && record.data.investment == "Exit Date" && record.modified != null) {
if (record.modified.column1 == "" || record.modified.column1 == null) {
return;
} else {
value = record.modified.column1;
}
if (value.indexOf('Date') != -1) {
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
} else {
if (isNaN(value)) {
if (value.indexOf('Date') != -1) {
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
return (new Date(value)).format('m/d/Y');
} else {
if (record.data.investment == "General Comments") {}
return value;
}
}
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
}
},
column2: function (value) {
if (value == '') {
return value;
} else {
return value;
}
},
column3: function (value, grid, record) {
if (value == "" && record.data.investment == "Exit Date" && record.modified != null) {
if (record.modified.column3 == "" || record.modified.column3 == null) {
return;
} else {
value = record.modified.column3;
}
if (value.indexOf('Date') != -1) {
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
} else {
if (isNaN(value)) {
if (value.indexOf('Date') != -1) {
var val = MS.ImpactSisterApp.convertToDate(value);
return (new Date(val)).format('m/d/Y');
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
} else {
if ((typeof(value) === 'date') ? true : (typeof(value) === 'object') ? value.constructor.toString().match(/date/i) !== null : false) {
return (new Date(value)).format('m/d/Y');
} else {
return value;
}
}
}
},
column4: function (value) {
if (value == '') {
return value;
} else {
return value;
}
},
onDestroy: function () {
this.dealDetailsInfo = null;
this.gridToolbar = null;
invId = null;
repPeriodCombo.un("select", this.reLoadGrid, this);
MS.ImpactSisterApp.SisterAppEventManager.un("reportingPeriodComboChanged", this.reLoadGrid, this);
MS.ImpactSisterApp.SisterAppEventManager.un("loadFinancialSet", this.reLoadFinancial, this);
}
});

function showResult(btn) {
if (btn == 'yes') {
var parstr = Ext.getCmp('recordsHidden').el.dom.value;
parstr = parstr.split('&');
Ext.getCmp('recordsHidden').el.dom.value = "";
MS.ImpactSisterApp.SisterAppEventManager.fireEvent("saveFinancialProjection", {
"method": "saveFinancialProjection",
"investmentId": parstr[19],
"reportingPeriodId": parstr[20],
"InvLeveIIrrPerInvCommBook": parstr[0],
"InvLevelEqtyMultiplePerInvCommBook": parstr[1],
"InvLeveIIrrPerFinUndWrit": parstr[2],
"InvLevelEqtyMultiplePerFinUndWrit": parstr[3],
"IrrBefFeesAftHedPerInvCommBookUsd": parstr[4],
"EqMulBefFeesAftHedPerInvCommBookUsd": parstr[5],
"IrrBefFeesBefHedPerInvCommBookLc": parstr[6],
"EqMulBefFeesBefHedPerInvCommBookLc": parstr[7],
"IrrBefFeesBefHedPerFinUndWritLc": parstr[8],
"EqMulBefFeesBefHedPerFinUndWritLc": parstr[9],
"NetIrrAftFeesAftHedPerInvCommBook": parstr[10],
"NetEqMulAftFeesAftHedPerInvCommBook": parstr[11],
"NetIrrAftFeesAftHedPerFinUndWrit": parstr[12],
"NetEqMulAftFeesAftHedPerFinUndWrit": parstr[13],
"ExitDatePerInvCommBook": parstr[14],
"ExitDatePerFinUndWrit": parstr[15],
"InvCommAppAllocPerInvCommBook": parstr[16],
"InvCommAppAllocPerFinUndWrit": parstr[17],
"GeneralComments": parstr[18]
});
}
}

Condor
14 Dec 2010, 2:29 AM
TabPanel doesn't support closing all tabs. Usually the 'main' tab is configured with closable:false.

amanind
14 Dec 2010, 2:38 AM
condor, I am using viewport with 3 panels
There is a tree in west panel and when i click on any node, it will open tabPanel in central panel with 2 fieldsets(every fieldset have grid).
like this I can open 10 tabs ata atime but while closing it gives error as i explain above.
The above code is to display tab content(fieldset with grid).

so i want to know, do i have to distroy any method at the time of closing tabs or there is any issue in my code.

amanind
14 Dec 2010, 3:55 AM
Condor, any suggestion what I can do in this case?
Any change in code suggession

Condor
14 Dec 2010, 4:03 AM
Some problems:
1. 'id's need to be unique. FinancialProjections contains several fixed ids, that would get duplicated if you create more than one instance.
2. Don't use autoWidth:true. Instead use layout:'anchor' with anchor:'100%' (or anchor:'-'+Ext.getScrollBarWidth() if the container has a scrollbar).
3. Configure your stores with autoDestroy:true, so the store will also be destroyed when you close the tab.

amanind
14 Dec 2010, 4:21 AM
Thanks condor, you are great
error is due to same id of grid