PDA

View Full Version : custom renderer's?



sferg989
2 Jun 2011, 5:51 AM
I am trying to modify column 1 (Task Name) based on the data in Column 2 (data type) . I am having trouble figuring out what exactly each one of the parameters do?




function changeImage(val, metaData, record) {
if (record.get('type'), record = 'task') {
metaData.css = 'task';
} else if (record.get('type'),record = 'resource') {
metaData.css = 'resource';
} else if (record.get('type'),record = 'step') {
metaData.css = 'step';
}
return val;
}



Thanks for the help in advance

friend
2 Jun 2011, 8:38 AM
You appear to have syntactic/semantic errors in your code sample. Maybe these are cut and paste errors?

I'm hoping that you mean to do this:



if (record.get('type') == 'task') {
metaData.css = 'task';
} else if (record.get('type') == 'resource') {
metaData.css = 'resource';
} else if (record.get('type') == 'step') {
metaData.css = 'step';
}
As for the incoming parameter descriptions, visit the API docs for Ext.grid.Column (http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.grid.Column) and expand the renderer config option (noting that there are actually six incoming parameters available for use).

sferg989
2 Jun 2011, 11:07 AM
You were right; I had a syntax error

mitchellsimoens
2 Jun 2011, 4:19 PM
I am having trouble figuring out what exactly each one of the parameters do?


renderer: function(value, metaData, record, rowIndex, colIndex, store) { .... }

value = value in the record based on the dataIndex
metaData = change the look of each cell
record = um, the record of that row
rowIndex = the index in the Store of that row
colIndex = the column index of that Column
store = the Store