Ext JS – Putting an icon in a grid cell

One way to put an icon in a grid cell

1. Create CSS for the icon

td.locked {
	background: url(./images/icons/lock.png) no-repeat center !important;

2. Create a renderer that sets the css on the cell

var lockedRenderer = function(value, meta, record, rowindx, colindx, store) {
	if (value === true) {
		meta.css = 'locked'
	return '';

3. Use column renderer in the column model. Code is just showing the column config for the one column.

{header: 'Locked', sortable: true, dataIndex: 'locked', renderer: lockedRenderer},


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s