<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Setting table cell style based on data values - How?</title>
	<link>http://www.trirand.com/blog/?page_id=393/discussion/setting-table-cell-style-based-on-data-values-how</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/discussion/setting-table-cell-style-based-on-data-values-how/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>grantdd on Setting table cell style based on data values - How?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/setting-table-cell-style-based-on-data-values-how#p16005</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/setting-table-cell-style-based-on-data-values-how#p16005</guid>
        	        	<description><![CDATA[<p>I use afterInsertRow option for any row or cell manipulation.&#160; Here&#39;s a quick example using the setCell method:</p>
<p>afterInsertRow : function(rowid, rowdata, rowelem)</p>
<p>{</p>
<p>&#160;&#160;&#160;&#160;&#160; if (rowdata.columnXcell == desiredData)</p>
<p>&#160;&#160;&#160;&#160;&#160; {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; &#160; &#160; // Add a class to the cell.&#160; You could also pass something like this: {&#39;background-color&#39;:&#39;red&#39;}.</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Note the empty quotes in the setCell options--pass this if you want to leave the value of the cell unchanged</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160; $(&#39;#gridID&#39;).jqGrid(&#39;setCell&#39;,&#160; rowid, &#39;colModelIndex&#39;, &#39;&#39;, &#39;ClassName&#39;);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Or to change the entire row:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#&#39;+rowid).css({&#39;background-color&#39;:&#39;green&#39;});</p>
<p>&#160;&#160;&#160;&#160;&#160; }</p>
<p>}</p></p>
]]></description>
        	        	<pubDate>Sun, 28 Mar 2010 08:12:44 +0300</pubDate>
        </item>
        <item>
        	<title>patrickj on Setting table cell style based on data values - How?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/setting-table-cell-style-based-on-data-values-how#p15510</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/setting-table-cell-style-based-on-data-values-how#p15510</guid>
        	        	<description><![CDATA[<p>newbie qn - not sure if this is the correct section for this type of query:</p>
<p>I need to display data in a grid and set the cell background color based on the the underlying data values - e.g. late payment dates are red for 90 days; orange for 180 days etc). &#160;I need to do this at the cell level, not the row level as there can be several cells on the same row with a different status.&#160;</p>
</p>
<p>I&#39;ve thought about assigning additional adjacent hidden columns containing the style name on the server (invoking business rules to set the value) - then massaging the corresponding cell&#39;s style accordingly - but am not sure if/how that would work. Are there any examples of this available?</p>
<p>TIA,</p>
<p>Patrick</p>
]]></description>
        	        	<pubDate>Tue, 09 Mar 2010 06:40:22 +0200</pubDate>
        </item>
</channel>
</rss>