Always get Display Field value in IE
volcom721 opened this issue · 7 comments
Dear elmasse:
I have a problem here. I create a combobox and use "Ext.i18n.Bundle" to set the value of displayfield. I found the renderer always get displayfield value, not valuefield. And this is only occur in IE, it is correct in firefox. Do you know why happen about this problem?
this is a part of code:
...
{ header: "Policy", dataIndex:'policy', flex: 1, sortable: true, align:'center',
renderer:function(value){
return (value.indexOf('ro') > -1 )?
Ext.i18n.appBundle.getMsg('Sharev.READY_ONLY'):
Ext.i18n.appBundle.getMsg('Sharev.READY_WRITE');
},
editor:{
xtype:'combobox',
mode: 'local',
triggerAction: 'all',
forceSelection:true,
displayField:'label',
valueField:'policy',
store:{
xtype: 'jsonstore',
fields:[ 'label', 'policy' ],
data:[
{label: Ext.i18n.appBundle.getMsg('Sharev.READY_ONLY'), policy: 'ro'},
{label: Ext.i18n.appBundle.getMsg('Sharev.READY_WRITE'), policy: 'rw'}
]
}
}//eo editor
}
I'll deep into this. Can you tell me which version of ExtJS are you using + IE?
As a simple solution, you can read the values from the record on the renderer function:
renderer:function (value, metaData, record, rowIndex, colIndex, store){
return (record.get('policy').indexOf('ro') > -1 )?
Ext.i18n.appBundle.getMsg('Sharev.READY_ONLY'):
Ext.i18n.appBundle.getMsg('Sharev.READY_WRITE');
}
Dear elmasse:
Thank for you answer. The version of extjs is 4.1.1, and browser is IE8.
thanks.
Dear elmasse:
I use that you suggest solution still can't work too, because the value of 'record.get('policy')' was changed to i18n, so the value will always not 'ro' and the return value for render will always is Ext.i18n.appBundle.getMsg('Sharev.READY_WRITE'). In addition, i am tracing the code (ext-debug-all.js) now. I found the value displayTplData is empty in onItemClick function of 'Ext.form.field.ComboBox'.
thanks.
closed as Cannot Reproduce. Feel free to re-open and provide a test case with latest version. Thanks.
Hi, I have had this exact same issue and solved it, thought I would share my investigation here.
Actually we had this issue when running the application as served from our integration server, but not on our development machine. Going into debug, we found that all values passed through i18n had \r
characters appended, which prevented the ComboBox
component from finding its way around.
As is turns out, the issue is caused by a combination of SVN eol:style
property set to native and our CI server running Windows (and thus checkouting the .properties files with Windows-style, CR+LF EOF).
Thus, if you want to avoid this issue, ensure that the .properties files are served with Unix-style, LF-only EOL.
As a side note, Ext.i18n.Bundle.getMsg
could also get rid of the CR characters ;)
I'm reopening this issue. Thanks @mithfindel for posting this information. I will add a test case with different EOL styles to property reader.
@mithfindel I just added 2 unit tests for handling EOL. I cannot make them fail, yet. Please feel free to get back to me with any change you consider for this particular issue.
Thanks
Max