PDA

View Full Version : [STALE-595] default value for ComboBox



StuartMilne
18 Feb 2010, 2:34 AM
Hi Guys

This might be a known issue but I could not find anything regarding the issue. It only happens in IE 7 & 8.

Basically I have a grid with an Add button in the toolbar that loads a form when clicked.

The form has 4 comboBoxes with default values. On the first click the form loads with the default values and I can then make selections from these comboBoxes and save a record.

However under IE 7 & 8 when I click the add button for the second time the form loads the comboBoxes with empty values. The data in the data stores is still there.

If I then close this form and then click the add button again the form loads as it should.

Is this a known issue.

Kind regards
Stuart Milne

evant
18 Feb 2010, 2:39 AM
Please post a test case that demonstrates the issue, see: http://www.extjs.com/forum/showthread.php?t=71015

StuartMilne
18 Feb 2010, 6:15 AM
Ext version tested:

Ext 3.0 rev 3


Adapter used:

ext


css used:

only default ext-all.css




Browser versions tested against:

IE7
IE8
FF3 (firebug 1.3.0.10 installed)
Safari 4


Operating System:

WinXP Pro


Description:

This might be a known issue but I could not find anything regarding the issue. It only happens in IE 7 & 8.

Basically I have a grid with an Add button in the toolbar that loads a form when clicked.

The form has 4 comboBoxes with default values. On the first click the form loads with the default values and I can then make selections from these comboBoxes and save a record.

However under IE 7 & 8 when I click the add button for the second time the form loads the comboBoxes with empty values. The data in the data stores is still there.

If I then close this form and then click the add button again the form loads as it should.
Is this a known issue.


Test Case:
This is the code for my form


{literal}
function initialize(pParams)
{

var ruleStore = new Ext.data.ArrayStore({
id: 0,
fields: ['id', 'name'],
data: [
{/literal}
{section name=index loop=$routingRules}
{if $smarty.section.index.last}

['{$routingRules[index].id}', '{$routingRules[index].name}']
{else}
['{$routingRules[index].id}', "{$routingRules[index].name}"],
{/if}
{/section}
{literal}
]
});

var ruleCombo = new Ext.form.ComboBox({
id: 'rule',
name: 'rule',
width:200,
fieldLabel: '{/literal}{#str_LabelCondition#}{literal}',
mode: 'local',
editable: false,
forceSelection: true,
selectOnFocus: true,
triggerAction: 'all',
store: ruleStore,
listeners:{
select:{
fn: function(comboBox, record, index){
var conditionValueBox = Ext.getCmp('conditionvalue');
var conditionBox = Ext.getCmp('condition');
var siteBox = Ext.getCmp('site');
if(index == 4)
{
conditionValueBox.setDisabled(true);
conditionValueBox.clearValue();
conditionValueBox.store.removeAll();

conditionBox.setDisabled(true);
conditionBox.clearValue();
conditionBox.store.removeAll();

siteBox.setDisabled(true);
siteBox.clearValue();
siteBox.store.removeAll();
}
else
{
conditionValueBox.setDisabled(false);
conditionBox.setDisabled(false);
siteBox.setDisabled(false);

conditionValueBox.clearValue();
conditionValueBox.store.removeAll();
conditionValueBox.store.reload({
params: { conditionId: comboBox.getValue() }
});

conditionBox.setValue('{/literal}{#str_LabelIs#}{literal}');
siteBox.setValue('{/literal}{#str_LabelNone#}{literal}');
}
}
}
},
valueField: 'id',
displayField: 'name',
useID: true,
value: '{/literal}{$ruleDefault}{literal}',
allowBlank: false,
post: true
});

var siteStore = new Ext.data.ArrayStore({
id: 0,
fields: ['id', 'name'],
data: [
['', '{/literal}{#str_LabelNone#}{literal}'],
{/literal}
{section name=index loop=$productionSites}
{if $smarty.section.index.last}
['{$productionSites[index].code}', '{$productionSites[index].name}']
{else}
['{$productionSites[index].code}', "{$productionSites[index].name}"],
{/if}
{/section}
{literal}
]
});

var siteCombo = new Ext.form.ComboBox({
id: 'site',
name: 'site',
width:200,
fieldLabel: '{/literal}{#str_LabelSiteCode#}{literal}',
mode: 'local',
editable: false,
forceSelection: true,
selectOnFocus: true,
triggerAction: 'all',
store: siteStore,
valueField: 'id',
displayField: 'name',
{/literal}
{if $defaultDisplay == 0}
value: '',
{else}
value: '{$siteDefault}',
{/if}
{literal}
useID: true,
allowBlank: false,
mode: 'local',
post: true
});

var conditionStore = new Ext.data.ArrayStore({
id: 0,
fields: ['id', 'name'],
data: [
{/literal}
{section name=index loop=$routingConditions}
{if $smarty.section.index.last}

['{$routingConditions[index].id}', '{$routingConditions[index].name}']
{else}
['{$routingConditions[index].id}', "{$routingConditions[index].name}"],
{/if}
{/section}
{literal}
]
});

var conditionCombo = new Ext.form.ComboBox({
id: 'condition',
name: 'condition',
width:75,
mode: 'local',
editable: false,
hideLabel: true,
forceSelection: true,
selectOnFocus: true,
triggerAction: 'all',
store: conditionStore,
valueField: 'id',
displayField: 'name',
useID: true,
value: '{/literal}{$conditionDefault}{literal}',
allowBlank: false,
post: true
});

var valueStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'index.php?fsaction=AdminSitesOrderRouting.getConditionValueStore&ref={/literal}{$ref}{literal}'}),
reader: new Ext.data.ArrayReader({
idIndex: 0},
Ext.data.Record.create([
{name: 'condValue', mapping: 0},
{name: 'name', mapping: 1}
])
)
});

var conditionValueCombo = new Ext.form.ComboBox({
id: 'conditionvalue',
name: 'conditionvalue',
width:390,
mode: 'local',
editable: true,
minChars:1,
hideLabel: true,
forceSelection: true,
selectOnFocus: true,
triggerAction: 'all',
store: valueStore,
valueField: 'condValue',
displayField: 'name',
useID: true,
{/literal}
{if $defaultDisplay == 0}
emptyText: '{$conditionValueDefault}',
{else}
value: '{$conditionValueDefault}',
{/if}
{literal}
allowBlank: false,
mode: 'local',
typeAhead: true,
post: true
});

var dialogFormPanelObj = new Ext.FormPanel({
labelAlign: 'left',
labelWidth:60,
autoHeight: true,
frame:true,
bodyStyle:'padding:5px 5px 0px 0px',
items: [{
layout:'column',
items:[{
layout: 'form',
width: 270,
items: [ruleCombo, siteCombo]
},{
layout: 'form',
width: 80,
items: [conditionCombo]
},{
layout: 'form',
width: 410,
items: [conditionValueCombo]
}]
}],
buttons: [{
text: '{/literal}{#str_ButtonCancel#}{literal}',
handler: closeHandler
},{
text: '{/literal}{#str_ButtonSave#}{literal}',
handler: saveHandler
}]
});

gDialogObj = new Ext.Window({
id: 'dialog',
title: '{/literal}{$title}{literal}',
closable:false,
closeAction: 'hide',
plain:true,
modal:true,
draggable:true,
resizable:false,
layout: 'fit',
autoHeight:true,
width: 800,
items: dialogFormPanelObj
});

var loadValueBox = Ext.getCmp('conditionvalue');
var ruleBox = Ext.getCmp('rule');

loadValueBox.store.reload({
params: { conditionId: ruleBox.getValue() }
});

if (ruleBox.getValue() == 4)
{
var emptyConditionBox = Ext.getCmp('condition');
var emptyConditionValueBox = Ext.getCmp('conditionvalue');
var emptySiteBox = Ext.getCmp('site');

emptyConditionBox.setDisabled(true);
emptyConditionValueBox.setDisabled(true);
emptyConditionBox.reset();
emptySiteBox.setDisabled(true);
emptySiteBox.reset();
}

gDialogObj.show();
gDialogObj.center();
}

/* save functions */
function saveHandler(btn, ev)
{
var submitURL = '{/literal}{$submitURL}{literal}';
var fp = this.ownerCt.ownerCt, form = fp.getForm();

Ext.taopix.formPanelPost(fp, form, null, submitURL, '{/literal}{#str_MessageSaving#}{literal}', saveCallback);
}

function saveCallback(pUpdated, pActionForm, pActionData)
{
if (pUpdated)
{
var gridObj = gMainWindowObj.findById('maingrid');
var dataStore = gridObj.store;

gridObj.store.load();
gDialogObj.close();
}
else
{
icon = Ext.MessageBox.WARNING;

Ext.MessageBox.show({
title: pActionData.result.title,
msg: pActionData.result.msg,
buttons: Ext.MessageBox.OK,
icon: icon
});
}
}

/* close functions */
function closeHandler(btn, ev)
{
gDialogObj.close();
}
{/literal}



See this URL : http://


Steps to reproduce the problem:

See description


The result that was expected:

See description


The result that occurs instead:

See description


Screenshot or Video:

See description


Debugging already done:

none


Possible fix:

not provided

StuartMilne
19 Feb 2010, 3:48 AM
Was just wondering if anyone had a chance to look at this.

Jamie Avins
19 Feb 2010, 8:41 AM
Not as of yet, we have this in our tracking system and will address it.

StuartMilne
22 Feb 2010, 3:10 AM
After further testing on our side it seems as though it is a problem with trying to initialize comboBoxes in I.E.

Have you guys made any progress?

Jamie Avins
22 Feb 2010, 9:04 AM
This thread will be updated as soon as we address the issue.

evant
30 Mar 2010, 11:34 PM
We're going to need more information to address this. Can you provide a drop in test case that demonstrates the issue?