Hi All,
I am having difficulty with my combo box on a form. Let me give some background first.
I have a GridPanel inside a TabPanel. I use the selected row to populate a form via the id. One of the fields on the form is a combobox and then the form is displayed is a Window. The selected data is displayed on the form, including the combobox.
Here is my problem, when I select something from the dropdown the selected value does not replace the original value and the field becomes blank. I have been trying things that I think might help but to no avail. I seek your help. I am supplying the code, in its entirety, sorry, but I want to supply as much information as I can.
One other thing, if I type something in the combobox the data in the grid shortens or goes away. ComponentOne Studio for ActiveX - Support:: The text portion of the combo box goes blank after a selection is made. The new value is not actually written to the database until the current record http://www.componentsource.com/products/componentone-studio-activex/forum.htmlHOME | SUGI 27: Developing Master/Detail Applications Using Form & Table :: File Format: PDF/Adobe Acrobat - View as HTMLWhy does it not show up? A6: Check to see if the values in your items list for the combo. box match the value for the column linked to the combo box in http://www2.sas.com/proceedings/sugi27/p046-27.pdfHOME |
I am having another problem that I believe is more of a loading issue. The first time the window with the form is displayed the fields are empty. While this is a problem for me the combobox problem is eating away lots of time.
I thank you for your help.
This is just an update with, hopefully, code examples. The complete code is in the attached file. I am also hoping the tags put the code in those scroll boxes.
This is the combobox code:
// This code use to be in the [items:] of the form and it did not work there. Just wanted to throw that
// in as extra information.
var projectHeadCombo = Tam.gui.ComboBox({id:'df.project_head',fieldLabel: 'Project Head',store:Tamdata.getProjectHeadStore(),hiddenNa me:'project_head'});
Tam.gui.ComboBox = function (config) {
var id = config.id;
var fieldLabel = config.fieldLabel;
var store = config.store;
var hiddenName = config.hiddenName;
return new Ext.form.ComboBox(
{
id: id,
fieldLabel: fieldLabel,
//name: 'project_head',
mode: 'local',
triggerAction: 'all',
store: store,
displayField: 'display',
valueField: 'value',
editable: false,
selectOnFocus: true,
hiddenName: hiddenName, // that's not it.
forceSelection: true
});
};
This is the Form code: (the id on the textfields were added to try and get the form to display data the first time.
/*============== START FormPanel ==============*/
form = new Ext.FormPanel(
{
id: 'disaster-form',
labelAlign: 'right',
labelWidth: 150, // label settings here cascade unless overridden
frame:true,
header:false,
title: 'Disaster Entry',
bodyStyle:'padding:5px 5px 0',
width: 350,
autoScroll: true,
defaults: {width: 230},
//defaultType: 'textfield',
// url:'save-form.php',
items: [{
xtype: 'textfield',
id: 'df.disaster_number',
fieldLabel: 'Disaster Number',
name: 'disaster_number',
disabled: true,
allowBlank:false
},
projectHeadCombo
,{
xtype: 'textfield',
id: 'df.project_officer',
fieldLabel: 'Project Officer',
name: 'project_officer'
},{
xtype: 'textfield',
id: 'df.disaster_description',
fieldLabel: 'Disaster Description',
name: 'disaster_description'
}
],
buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
});
/*============== END FormPanel ==============*/
And this is the Grip where the data comes from:
/*================================================= ================================================== ========*/
/* Grid */
/*================================================= ================================================== ========*/
Tam.gui.Grid = function (config) {
var tabId = config.tabId;
this.getGrid = function(config) {
var columnModel = config.columnModel;
var store = config.store;
var formId = 'disaster-form';
var lastSelectedRow;
this.rowSM = new Ext.grid.RowSelectionModel(
{
singleSelect:true,
listeners: {
'rowselect': function(sm, row, rec) {
Ext.getCmp(formId).getForm().loadRecord(rec);
Ext.getCmp(formId).getForm().applyToFields(rec);
dasasterGridRow = row;
lastSelectedRow = row;
}
}
});
this.grid = new Ext.grid.GridPanel(
{
store: store,
cm: columnModel,
sm: this.rowSM,
viewConfig: {
//forceFit:true // forces the columns to fit the window
autoFill:true
},
autoWidth: true,
//height:300,
autoHeight:true,
//renderTo: 'main-display',
iconCls:'icon-grid',
listeners:
{
render: function(g) {
g.getSelectionModel().selectRow(0);
},
delay: 10 // Allow rows to be rendered.
}
});
this.grid.on('rowclick', function(grid, rowIndex, e) {
var record = grid.getStore().getAt(rowIndex);
//alert(rowIndex);
});
return this.grid;
}
}
Tam.data.loadForm = function (config) {
var record = config.record;
var tabId = config.tabId;
if (tabId == 'disaster') {
form.setValue('df.disaster_number') = record.get('disaster_number');
}
}
/*-- GRID FUNCTION END --*/
Thank you so much for responding,
I have tried this and the result did not change. I had read on other post where you should use hiddenName because this is the one you need to use when posting.
Do you have another Idea I might try?
Again thanks you.
Remove name:'project_head' and replace with hiddenName:'project_head'.
I Am a Sinner – What About You?
Global Sourcing and Supplier Online by Dylan
|