View Full Version : How to Add sprite to a grid

Sawan Samal
28 Mar 2014, 2:50 AM
Hi folks,
I'm new to Ext js.
I want to add sprite to the grid.
But in example threads i could find only adding data or stores to grid. I tried but its not working.:(
can anyone tell me how to tackle this problem and please let me know mistake in my code.

Ext.define('My.grid', {
extend : 'Ext.grid.Panel',
xtype : 'my-grid',
title : 'Grid',
store : Ext.create('Ext.data.ArrayStore', {
fields : ['name'],
items : [
{Ext.create('Ext.draw.Component', {
renderTo: Ext.getBody(),
width: 200,
height: 200,
items: [{
type: "path",
path: "M150 0 L180 50 L150 100 L250 100 L280 50 L250 0 Z ",

fill: "purple"
columns : [
header : 'Name',
dataIndex : 'name'

please reply soon.
thanks in advance

28 Mar 2014, 6:20 AM
Where is the sprite supposed to paint? You have renderTo set to getBody() of browser?
You have added the sprite as an item to the store?

I can get it paint above the grid data, but I suspect that is not what you want.

Sawan Samal
29 Mar 2014, 10:21 PM
Hi thnaks for reply.
I'm taking from the user no. of rows and columns and based upon that i have to display my sprite.
for ex:if row:2
then it should display:
5 sprites with 3 sprites in each column.

so i tried by not rendering to body the sprite and want to add that to Grid. but I failed.
can anyone post sample code for adding a sprite over grid surface.

thanks in advance
with regards