PDA

View Full Version : [DUP] [4.2.0]: The option emptyCellText of the column is ignored



Qtx
17 Apr 2013, 12:27 AM
REQUIRED INFORMATION


Ext version tested:

Ext 4.2.0


Browser versions tested against:

IE 10.0.9200
FF 19.0.2, firebug 1.11.12
Opera 12.14
Chrome 26.0.1410.43
Safari 5.1.7


Description:

I set the emptyCellText to [empty], but it is not displayed in the empty cells in ExtJS 4.2.
The same works in ExtJS 4.1.0.
I looked through the sources of the ExtJS 4.2, the propery emptyCellText is nowhere used in the code.


Steps to reproduce the problem:

Take the example array-grid.html from 4.1.0
Make a cell empty through setting some data to empty in the data array.
Set the emptyCellText to [empty].
View the example under the versions 4.1.0 and 4.2.0.
The emptyCellText is shown in the empty cells in the version 4.1.0.
The emptyCellText is not shown in the empty cells in the version 4.2.0.


The result that was expected:

The emptyCellText should be shown in the empty cells.


The result that occurs instead:

The emptyCellText is not shown in the empty cells.


HELPFUL INFORMATION

See this URL for live test case:

4.1.0
http://www.point-constructor.com/ext410/examples/grid/array-grid.html

4.2.0
http://www.point-constructor.com/ext420/examples/grid/array-grid.html

Debugging already done:

none


Possible fix:

not provided


Additional CSS used:

only default ext-all.css
custom css (include details)


Operating System:

Windows 7

*EDIT BY SLEMMON
also tested in 4.2.1.760


Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': null, "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name', emptyCellText: '<span style="color: LightGray;">{unnamed}</span>' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});

slemmon
17 Apr 2013, 7:28 AM
Thanks for the report! I have opened a bug in our bug tracker.

Qtx
18 Apr 2013, 12:16 AM
I found the place where it should be used.

Table.js, Line 985

renderCell: function(column, record, recordIndex, columnIndex, out) {
var me = this,
selModel = me.selModel,
cellValues = me.cellValues,
classes = cellValues.classes,
fieldValue = record.data[column.dataIndex],
cellTpl = me.cellTpl,
value, clsInsertPoint;

cellValues.record = record;
cellValues.column = column;
cellValues.recordIndex = recordIndex;
cellValues.columnIndex = columnIndex;
cellValues.cellIndex = columnIndex;
cellValues.align = column.align;
cellValues.tdCls = column.tdCls;
cellValues.style = cellValues.tdAttr = "";
cellValues.unselectableAttr = me.enableTextSelection ? '' : 'unselectable="on"';

if (column.renderer && column.renderer.call) {
value = column.renderer.call(column.scope || me.ownerCt, fieldValue, cellValues, record, recordIndex, columnIndex, me.dataSource, me);
if (cellValues.css) {
// This warning attribute is used by the compat layer
// TODO: remove when compat layer becomes deprecated
record.cssWarning = true;
cellValues.tdCls += ' ' + cellValues.css;
delete cellValues.css;
}
} else {
value = fieldValue;
}

Wrong: cellValues.value = (value == null || value === '') ? '& #160; ' : value;
Correct: cellValues.value = (value == null || value === '') ? column.emptyCellText : value;

// Calculate classes to add to cell
classes[1] = Ext.baseCSSPrefix + 'grid-cell-' + column.getItemId();

// On IE8, array[len] = 'foo' is twice as fast as array.push('foo')
// So keep an insertion point and use assignment to help IE!
clsInsertPoint = 2;

if (column.tdCls) {
classes[clsInsertPoint++] = column.tdCls;
}
if (me.markDirty && record.isModified(column.dataIndex)) {
classes[clsInsertPoint++] = me.dirtyCls;
}
if (column.isFirstVisible) {
classes[clsInsertPoint++] = me.firstCls;
}
if (column.isLastVisible) {
classes[clsInsertPoint++] = me.lastCls;
}
if (!me.enableTextSelection) {
classes[clsInsertPoint++] = Ext.baseCSSPrefix + 'unselectable';
}

classes[clsInsertPoint++] = cellValues.tdCls;
if (selModel && selModel.isCellSelected && selModel.isCellSelected(me, recordIndex, columnIndex)) {
classes[clsInsertPoint++] = (me.selectedCellCls);
}

// Chop back array to only what we've set
classes.length = clsInsertPoint;

cellValues.tdCls = classes.join(' ');

cellTpl.applyOut(cellValues, out);

// Dereference objects since cellValues is a persistent var in the XTemplate's scope chain
cellValues.column = null;
},

hdave
4 Feb 2014, 6:14 AM
+1 for this fix

PLoginoff
4 Jun 2014, 11:34 PM
I came across this bug today.

RoyalSens
30 Jul 2014, 12:40 AM
And today it hit me. Is there an ETA for a bugfix release of ExtJS?