PDA

View Full Version : Grid column renderer reporting wrong colIndex



medusadelft
31 Jul 2011, 5:01 AM
REQUIRED INFORMATION


Ext version tested:

Ext 4.02 rev a


Browser versions tested against:

IE8
FF4 (firebug 1.7.x installed)
Chrome


Description:

According to the documentation, the 4th parameter of a grid-column-renderer it should report the column index. But it sticks with 1.


Steps to reproduce the problem:

MVC-app. The console-log from function checkForIsLeaf in the next example code reports 1 twice. Can provide complete code if necessary.


The result that was expected:

2 is expected for the second console log (of colIndex).


The result that occurs instead:

reports 1 twice


Test Case:

MVC-app snippet:


var contextMenuDefaultProjectTree = Ext.create('Ext.menu.Menu', {
id: 'ctxmenu-defaultprojecttree'
,items: getMenuDefaultProjectTree(1)
});

Ext.define('TS.view.defaultproject.Tree' ,{
extend: 'Ext.tree.Panel',
alias : 'widget.defaultprojecttree',

title : objLang.projects.defaultprojects.titles.tree
,useArrows: true

// ,border: false
,store: 'DefaultProjects'
,rootVisible: false
,id: 'defaultproject-id'

,initComponent: function() {

this.columns = [
{text: objLang.projects.defaultprojects.fields.tree, dataIndex: 'text', xtype: 'treecolumn', flex: 1}
,{text: objLang.projects.defaultprojects.fields.isActive, dataIndex: 'is_active', renderer: this.checkForIsLeaf, flex: .2}
,{text: objLang.projects.defaultprojects.fields.defaultRate, dataIndex: 'default_rate', renderer: this.checkForIsLeaf, align: 'right', flex: .4}
];

this.dockedItems = [{
dock: 'top'
,xtype: 'toolbar'
,items: getMenuDefaultProjectTree(0)
}];


this.callParent(arguments);
}

,checkForIsLeaf: function(val, meta, record, colIndex, b) {
if (record.data.text == 'objLang' || record.data.leaf == false) {
return '';
} else {
console.log(colIndex);
console.log('val: '+val);
if (colIndex == 1) {
return showCheckImg(val);
} else if (colIndex == 2) {
return fillDecimals(val);
}
}
}

});


Store (json):


[{"depth":"0","leaf":false,"id":"i1-l1-r4","time_units_id":"1","code":"","is_active":"1","default_rate":"0.00","description":null,"text":"objProj","expanded":true,"children":[{"depth":"1","leaf":true,"id":"i2-l2-r3","time_units_id":"1","code":"DEVELOP","is_active":"1","default_rate":"50.00","description":"","text":"Development","expanded":false}]}]



HELPFUL INFORMATION


Screenshot or Video:

n/a


See this URL for live test case: http://


Debugging already done:

none


Possible fix:

not provided


Additional CSS used:

n/a


Operating System:

on 2 different OS, so OS independend.

medusadelft
31 Jul 2011, 5:06 AM
Hummmm, seems like the 5th parameter is reporting the colIndex. This should be store, so what's the fourth? Or shouldn't it be reported anyway?