PDA

View Full Version : Facing problem loading the record to the form.after migrating from 4.0.7 to 4.2.2



ImSatan
22 Nov 2013, 2:41 AM
I have Grid Panel and a form panel. Upon selecting a row in grid, I am populating the form panel with the values extracted from the selected row.
I am using Form.loadRecord(selectedrecord) to populate values the form panel.
It was working fine in 4.0.7, but after upgrading to 4.2.2, upon row selection neither does the values show up nor the fields.
I tried debugging and could see that form has the data updated correctly upon row selection.

Please help.

Grid Form
Server Domain OS Server: x
x y z Domain: y
OS: z

evant
22 Nov 2013, 2:48 AM
You didn't post any code, so it's not really possible to suggest anything.

ImSatan
25 Nov 2013, 1:25 AM
Ext.define('acm.ux.panel.DetailPanel', {
extend : 'Ext.form.Panel',
alias : 'widget.acmdetail',
recIndex : 0,
width : 200,
minSize : 100,
selectedRecord : null,
selectedPackage: null,
selectedPackageVersion: null,
parent: null,
initComponent : function() {
var me = this ;
me.callParent(arguments);
},
onSelectionChange : function(view, records) {


var me= this, tempIndex = -1;
me.records = records;
if (!Ext.isEmpty(records)) {
tempIndex = me.records.length-1;
}
if (tempIndex < 0) {
me.clearAllFields();
}else {
me.createFormFields();
}
me.fireEvent('recordChange', me.records.length);
me.loadCurrentRecord(tempIndex);
me.tableView=view ;


},
loadCurrentRecord : function(index) {
var me = this ;
if (index < 0) {
me.recIndex = 0;
me.records = [];
me.selectedRecord = null;
me.getForm().getFields().each(function(f) {
f.reset();
});
} else {
me.recIndex = index;
me.selectedRecord = this.records[me.recIndex];
if(me.section=='client' && me.subsection =='upgrade'){
me.selectedRecord.data['selectedPackageVersion']= me.selectedPackageVersion ;
}
me.getForm().loadRecord(me.selectedRecord);
}
me.fireEvent('navigationChange', this.recIndex, this.records.length);
},createFormFields:function(){
var me = this,field, items = [];
if(!me.isVisible() || me.items.items.slice().length > 0){
return ;
}
var uSection = gSections[me.section];
var uSubsections = uSection.subsections[me.subsection]; //getting the items assume it to be text fields with label
if(Ext.isDefined(uSubsections.detailFields)){
items = uSubsections.detailFields.items;
}
else if(Ext.isDefined(uSection.detailFields)){
items = uSection.detailFields.items;
}
me.updateDataDisplayInfo("");
me.add(items);
me.doLayout();
}
,clearAllFields:function(){
var me = this;
if(me.section=='logs' && me.subsection =='upgrade'){
field = me.child('#view');
if(!Ext.isEmpty(field)){
field.un({
scope:me,
click:me.onFieldClick
});
}
}
me.removeAll();
me.updateDataDisplayInfo('<B>No Record(s) is selected.</B>');

},

updateDataDisplayInfo:function(info){
var target = this.getTargetEl();
if(!Ext.isEmpty(target)){
target.update(Ext.DomHelper.markup(info));
}
}

While I debug I see form items getting added to the panel (createFormFields) after calling me.add(items); but its not visible in browser.
This widget is being added to the container.

Ext.define ('acm.ux.panel.SummaryContentPanel', {
extend:'Ext.Container'
,alias: 'widget.acmsummarycontent'
,section:''
,initComponent:function() {
var centerpanel = Ext.create('widget.container',{
region: 'center',
split: true,
headerAsText: false
,layout:'card'
,activeItem: 0
,height: '100%'
,items:[

{
itemId: 'acmsummary'
,xtype: 'acmsummary'
,title: '${bndl["gui.acm.summary.title"]}'
},{
itemId: 'orguview'
,title: '${bndl["gui.acm.summary.title"]}'
,xtype: 'acmorgutreepanel'
},{
itemId: 'dashboardview'
,xtype: 'acmdashboard'
}
]
});

var detailPanel = Ext.create('widget.acmdetail',{
parent: this,
region: 'east'
,xtype: 'acmdetail'
,title: '${bndl["gui.acm.detail.title"]}'
});
this.centerpanel = centerpanel ;
var config = {
layout:'border'
,height: '100%'
,plain: true
,items: [centerpanel,detailPanel]
,defaults:{margins:'0 0 0 0'}
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
this.callParent(arguments);
delete centerpanel ;
}

ImSatan
25 Nov 2013, 1:38 AM
Issue was with target.update(Ext.DomHelper.markup(info)); in function updateDataDisplayInfo.tx :)