-
16 May 2012 2:34 AM #1
Unanswered: Passing config parameters in renderer
Unanswered: Passing config parameters in renderer
Hi,
I am setting config parameters(driverTypeLookup, dataLookupValue) as shown in below code -
--------------------------------------------------------------------------------
actualColumns.push({header: columns[i].headerText, dataIndex: columns[i].dataLookupValue, xtype:'ewcolumn',
driverTypeLookup:columns[i].driverTypeLookup,
dataLookupValue:columns[i].dataLookupValue});
--------------------------------------------------------------------------------
I want to use these parameters (driverTypeLookup,dataLookupValue) in renderer of ewcolumn.
In ewcolumn class initComponent method, I am trying set config for tht class -
--------------------------------------------------------------------------------
initComponent: function() {
var config = {
driverTypeLookup1:this.driverTypeLookup
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
this.callParent(arguments);
console.log(" initComponent"+this.driverTypeLookup1);
},
--------------------------------------------------------------------------------
Is this correct way to set config variables?
Then I try to access this variable in renderer, it says 'undefined'
renderer : function(value, metaData, record, rowIndex, colIndex,store, view)
{
console.log(" in renderer"+this.driverTypeLookup1);
}
Can you please guide, how I can send some information to renderer ? Is config parameters correct solution. If yes, then how should I pass it?
Thanks
-
16 May 2012 7:10 AM #2Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,183
- Vote Rating
- 194
- Answers
- 433
Parameters are already there.. simply explore each in the console:
console.log('metaData>>'+metaData);
console.log('record>>'+record);
..
What are you trying to achieve?
Regards,
Scott.
-
21 May 2012 5:24 AM #3
Hi Scott,
I have a requirement to show images / icons in grid cell as per some data values.
Also we have created custom column class to make all logic separate, so it can be reused for other such requirements.
Now, My prob was, the 'crieteria data' was not accessible into 'custom column class' directly. So I wanted to pass it to renderer using some variables/parameters.
I have achieved it somehow.
Base class -
this.driverTypeLookup=[];
this.columnType=[];
for (var i=0; i< columns.length; i++){
this.driverTypeLookup[i]=columns[i].driverTypeLookup;
this.columnType[i]=columns[i].columnType;
actualColumns.push({header: columns[i].headerText, dataIndex: columns[i].dataLookupValue, xtype:'ewcolumn'
});
}
custom column class, where image selection logic is (ewcolumn) -
renderer: function(value, metaData, record, rowIndex, colIndex,store, view)
{
var columnType = this.columnType[colIndex];
var driverType = record.raw[this.driverTypeLookup[colIndex]];
}
Thank you for your help!
-
21 May 2012 6:31 AM #4Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,183
- Vote Rating
- 194
- Answers
- 433
Quick note .. have you tried using an actionColumn to display custom icons in the cells?I have a requirement to show images / icons in grid cell as per some data values.
Code:getClass: function(v, meta, rec) { // Or return a class from a function if (rec.get('change') < 0) { this.items[1].tooltip = 'Hold stock'; return 'alert-col'; // CSS rule } else { this.items[1].tooltip = 'Buy stock'; return 'buy-col'; } },
Scott.


Reply With Quote