<?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: Add css classes to row (or cell?) from json data</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/add-css-classes-to-row-or-cell-from-json-data</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/feature-request/add-css-classes-to-row-or-cell-from-json-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>feliccio on Add css classes to row (or cell?) from json data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/add-css-classes-to-row-or-cell-from-json-data#p20053</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/add-css-classes-to-row-or-cell-from-json-data#p20053</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>Can you please explain it a little more... I cant make it work.</p>
<p>Where the arrays "rowDelets_fundAlloc" and "rowAdds_fundAlloc" come from? I took your code and replaced "#list_fundAlloc" with my grid id. Is there other things I have to replace?</p>
</p>
<p>Thanks a lot</p>
</p>
<p>F&#233;lix</p></p>
]]></description>
        	        	<pubDate>Tue, 28 Sep 2010 16:56:15 +0300</pubDate>
        </item>
        <item>
        	<title>adamovic on Add css classes to row (or cell?) from json data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/add-css-classes-to-row-or-cell-from-json-data#p19436</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/add-css-classes-to-row-or-cell-from-json-data#p19436</guid>
        	        	<description><![CDATA[<p>However, I also think that we might need a custom CSS for each cell and formatter shall not be used for it (because it clashes with some other stuff, like in my case).</p>
</p>
<p>So one vote more for a new feature, something like cssUrl : &#39;someUrl&#39;</p>
]]></description>
        	        	<pubDate>Tue, 31 Aug 2010 16:49:00 +0300</pubDate>
        </item>
        <item>
        	<title>adamovic on Add css classes to row (or cell?) from json data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/add-css-classes-to-row-or-cell-from-json-data#p19435</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/add-css-classes-to-row-or-cell-from-json-data#p19435</guid>
        	        	<description><![CDATA[<p>This is something it seems we&#39;ll need (even more complicated binded with more features), you can use gridComplete to change CSS of rows/cellscurrently after the grid is rendered.</p>
<p>To change row CSS you could use something like :</p>
<pre>            jQuery(&#39;#list_fundAlloc&#39;).jqGrid(&#39;setRowData&#39;, false, &#39;jqgrid-delete&#39;);
</pre>
<p>And to change CSS of a cell &#160;:</p>
<pre> jQuery(&#39;#list_fundAlloc&#39;).setCell(id, name, &#39;&#39;  /* content will not change*/, &#39;jqgrid-editted&#39; /* new class*/);            </pre>
<pre></pre>
<pre>      gridComplete: function(){
        ids = jQuery("#list_fundAlloc").jqGrid(&#39;getDataIDs&#39;);
        for(var i=0;i &#60; ids.length;i++){
          var cl = ids[i];
          // cl = &#39;ACCCODES&#39;
          if (rowDelets_fundAlloc[cl] != undefined) {
            //var ret = jQuery(&#39;#list_books&#39;).jqGrid(&#39;getRowData&#39;,cl);
            jQuery(&#39;#list_fundAlloc&#39;).jqGrid(&#39;setRowData&#39;, false, &#39;jqgrid-delete&#39;);
          }
          if (rowAdds_fundAlloc[cl] != undefined) {
            jQuery(&#39;#list_fundAlloc&#39;).jqGrid(&#39;setRowData&#39;, false, &#39;jqgrid-new&#39;);
          }
          var edits = cellEdits_fundAlloc[cl];
          if (edits != undefined) {
            for (var name in edits) {
              jQuery(&#39;#list_fundAlloc&#39;).setCell(id, name, &#39;&#39;  /* content will not change*/, &#39;jqgrid-editted&#39; /* new class*/);            
            }
          } 
        }
      },
</pre>
]]></description>
        	        	<pubDate>Tue, 31 Aug 2010 16:47:23 +0300</pubDate>
        </item>
        <item>
        	<title>Skaffen on Add css classes to row (or cell?) from json data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/add-css-classes-to-row-or-cell-from-json-data#p19296</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/add-css-classes-to-row-or-cell-from-json-data#p19296</guid>
        	        	<description><![CDATA[<p>When working with grids of data I sometimes find it useful to be able to set a class on a row based on the data (e.g. showing a list of entries where some are flagged as deleted, set a class on the row of "deleteditem" such that a strike-through style can be applied to those rows) or a class on a cell based on the data (e.g. a date column of due date where the date is overdue then set a class on the cell of "itemoverdue" such that the cell text becomes red).</p>
<p>It does seem easy to do the row thing with jqGrid - about the only way I can see is to hook in a custom formatter on the cell which then modifies parent row&#39;s class, which seems an unnecessary faff. To set a css class on the cell would require a similar thing, however since HTML can be specified as cell data that can be worked around by just putting a div or span with a class into the celldata which wraps the string to show.</p>
<p>Anyways, for setting a row class ideally the json data structure would allow each row to optionally define e.g.:</p>
<p>&#160; rowcssclass : &#39;deleteditem&#39;,</p>
<p>If making it possible to also set css classes directly on cells based on the data, maybe also allow each row to have:</p>
<p>&#160; cellcssclasses : [&#39;&#39;,&#39;&#39;,&#39;&#39;,&#39;itemoverdue&#39;]</p>
<p>Or if using repeatitems set to false then maybe cellcssclasses could be an object keyed by column name, e.g.:</p>
<p>&#160; cellcssclasses : {&#39;duedate&#39;:&#39;itemoverdue&#39;}</p>
<p>Having such a facillity would make it easy to also do things like add icons to cells simply by using css classes which set the background image of the cell without having to insert html into the cell. Possibly I haven&#39;t put forward the best way of allowing it to be specified in the json data, but you get the idea about what I&#39;m after 🙂</p></p>
]]></description>
        	        	<pubDate>Wed, 25 Aug 2010 14:04:47 +0300</pubDate>
        </item>
</channel>
</rss>