I have a slightly tidier solution, avoiding the need to call setTimeout .
Basically my renderer adds to the class cell in which I want to use custom content, then I use the listeners combination to render my own content to this cell after the grid is present on the page.
renderer: function (value, metaData, record) { metaData.tdCls = metaData.tdCls + ' customContentCell'; return ''; }
An afterrender listener is added to the afterrender , which in turn adds a refresh listener to the gridview. I would like to use viewready or some other event, but this does not work in the ext version that I use, 4.0.2a.
listeners: { afterrender: function (grid) { var view = this.getView(); if (view) view.on('refresh', gridRenderCustomContent, this); } }
In this refresh function, I then go through all the records and display the contents in the cell. Something like the following, which simply adds an ext container to the cell, should work as a base.
var gridRenderCustomContent = function () { var recordIdx, colEl, chart, record, ganttHolder; for (recordIdx = 0; recordIdx < grid.store.getCount(); recordIdx++) { record = grid.store.getAt(recordIdx); holder = Ext.DomQuery.select('.customContentCell', grid.view.getNode(recordIdx)); if (holder.length) { colEl = holder[0]; colEl.innerHTML = ''; var customContentContainer = new Ext.create('Ext.container.Container', { style: 'height: 30px', items:[ ... ], renderTo: holder }); } } };
source share