Javascript-форум (https://javascript.ru/forum/)
-   ExtJS (https://javascript.ru/forum/extjs/)
-   -   ext.grid.panel доступ к tr (https://javascript.ru/forum/extjs/45097-ext-grid-panel-dostup-k-tr.html)

skrudjmakdak 14.02.2014 12:22

ext.grid.panel доступ к tr
 
задача в следующем:
есть грид со сторой. вот сразу дам код, чтобы лучше все это было представлять:
Ext.create('Ext.data.Store',
	{
	storeId:'simpsonsStore',
	fields:['id', 'name', 'count'],
	data:
		{
		'items': [
			{
			'id': 1,
			"name": "шампуни",
			"count": 40
			},
			{
			'id': 2,
			"name": "коровы",
			"count": 20
			},
			{
			'id': 3,
			"name": "холодильники",
			"count": 100
			},
			{
			'id': 4,
			"name": "редиски",
			"count": 1
			}]
		},
	proxy:
		{
		type: 'memory',
		reader:
			{
			type: 'json',
			root: 'items'
			}
		}
	});
	
Ext.create('Ext.grid.Panel',
	{
	title: 'Simpsons',
	id: 'grid1',
	store: Ext.data.StoreManager.lookup('simpsonsStore'),
	columns: [
		{
		text: 'id',
		dataIndex: 'id'
		},
		{
		text: 'наименование',
		dataIndex: 'name',
		flex: 1
		},
		{
		text: 'количество',
		dataIndex: 'count'
		}],
	height: 200,
	width: 400,
	renderTo: Ext.getBody()
	});


пока внимание на стору. вообщем есть поле count, оно числовое.
теперь мне надо, чтобы НЕ ячейка. а вся строка <tr style="background-color: xxx;">...</tr> меняла цвет в зависимости от значения count. пусть например будет так:
if (count < 10) color = red;
if (count < 100) color = yellow;
if (count >= 100) color = green;

есть предложения как получить доступ ко всей строке, а не к отдельной ячейки?

skrudjmakdak 14.02.2014 13:05

все, ответ нашел здесь
http://stackoverflow.com/questions/9...-grid-in-extjs


Часовой пояс GMT +3, время: 09:13.