[3.4.0] Ext.list.BooleanColumnView trueText, falseText, undefinedText are ignored
REQUIRED INFORMATION
Ext version tested: Browser versions tested against: DOCTYPE tested against: - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Description: - Ext.list.BooleanColumnView trueText, falseText, undefinedText options are ignored.
Steps to reproduce the problem: - Just run the sample script
The result that was expected: The result that occurs instead: - Default "true" and "false"
Test Case:
Code:
Ext.onReady(function () {
new Ext.ListView({
renderTo: Ext.getBody(),
height: 200,
width: 200,
store: new Ext.data.Store({
reader: new Ext.data.ArrayReader({
fields: [{
name: "test"
}]
}),
data: [
[true],
[false]
]
}),
columns: [{
xtype: "lvbooleancolumn",
dataIndex: "test",
header: "Test",
falseText: "NO",
trueText: "YES"
}]
});
});
HELPFUL INFORMATION
Possible fix: - Please see the two comments with "!!!".
Code:
<script type="text/javascript">
Ext.list.BooleanColumn = Ext.extend(Ext.list.Column, {
trueText: 'true',
falseText: 'false',
undefinedText: ' ',
constructor : function(c) {
Ext.apply(this, c); // !!! added
c.tpl = c.tpl || new Ext.XTemplate('{' + c.dataIndex + ':this.format}');
var t = this.trueText, f = this.falseText, u = this.undefinedText;
c.tpl.format = function (v) {
if(v === undefined){
return u;
}
if(!v || v === 'false'){
return f;
}
return t;
};
Ext.list.BooleanColumn.superclass.constructor.call(this, c); // !!! Replaced DateColumn with BooleanColumn. The superclass is the same, but just inconsistent.
}
});
Ext.reg('lvbooleancolumn', Ext.list.BooleanColumn);
</script>