I need to use cell renderers with a W2UI grid; I do like that :
Renderer function :
// Renderer function
let dateRenderer = function(record, index, columnIndex) {
return `<a href="http://www.example.com/check.php?date=${record.date_start}">${record.date_start}</a>`;
};
Columns definition :
// ...
// Renderer function call in columns definition
{ field: 'date_start', caption: 'Start date', render: dateRenderer },
// ...
It works well, but the problem is that I have a lot of different date columns in my grid and I need to create a different renderer function for each (for exemple whith record.date_start, record.date_end, record.date_shipping, etc...) when all dates in the grid are formated the same way.
Is it possible to get the value of concerned cell in renderer function and no entire record object ?
You can use following function to get the value of the related cell.
this.getCellValue(index, col_index);
// index - index of the record
// col_index - index of the column from the columns list
Have a look at this fiddle to understand it clearly.