<?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: Custom Cell Class</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class</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/custom-cell-class/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>MiB on Custom Cell Class</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p16276</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p16276</guid>
        	        	<description><![CDATA[<p>Hi</p>
<p>Where can i read more about complex structure of json? thx!</p>
]]></description>
        	        	<pubDate>Wed, 07 Apr 2010 13:01:06 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Custom Cell Class</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4772</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4772</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>The new 3.4 add such philosophy in JSON (read more complex structure). I think it is possible to extend some of this in XML.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 20 Feb 2009 02:28:13 +0200</pubDate>
        </item>
        <item>
        	<title>philbaud on Custom Cell Class</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4763</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4763</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I wonder if it wouldn&#39;t be more interesting to be able to add any attribute to the &#60;td&#62; tag, just by copying the attributes in the &#60;cell&#62; tag from the XML data only (sorry for that).</p>
<p>This would be interresting for style and also for sending parameters. Here is the code I&#39;ve writen :</p>
<p>1- arround line 683</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160; //var formatCol = function (elem, pos){ // change philbaud_20090220<br />&#160;&#160;&#160; &#160;&#160;&#160; var formatCol = function (elem, pos,attribs){&#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var ral = ts.p.colModel[pos].align;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(ral) { $(elem).css("text-align",ral);}<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // add_begin philbaud_20090220<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for (var attrib in attribs) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(elem).attr(attrib,attribs[attrib]);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // add_end philbaud_200890220&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(ts.p.colModel[pos].hidden) {$(elem).css("display","none");}<br />&#160;&#160;&#160; &#160;&#160;&#160; };<br />&#160;&#160;&#160; &#160;&#160;&#160; var resizeFirstRow = function (t,er){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $("tbody tr:eq("+er+") td",t).each( function( k ) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this).css("width",grid.headers[k].width+"px");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; grid.cols[k] = this;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; &#160;&#160;&#160; };<br />&#160;&#160;&#160; &#160;&#160;&#160; //var addCell = function(t,row,cell,pos) { // change philbaud_20090220<br />&#160;&#160;&#160; &#160;&#160;&#160; var addCell = function(t,row,cell,pos,attribs) {&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var td;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; td = document.createElement("td");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; formatter($(td,t),row,cell,pos,&#39;add&#39;);&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; row.appendChild(td);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; //formatCol($(td,t), pos); // change philbaud_20090220<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; formatCol($(td,t), pos,attribs);&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; };</p>
</p>
<p>2-around line 768</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; //addCell(t,row,v,i+gi+si); // remove philbaud_20090220<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // add-begin philbaud_20090220<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var attribs = new Array();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if((0 != this.attributes.length)){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; //attrib = "";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for (nCpt = 0; nCpt &#60; this.attributes.length; nCpt ++) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; //attrib += "; " + this.attributes[nCpt].nodeName + ":" + this.attributes[nCpt].nodeValue;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; attribs[this.attributes[nCpt].nodeName] = this.attributes[nCpt].nodeValue;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; addCell(t,row,v,i+gi+si,attribs);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // add-begin philbaud_20090220&#160;&#160;&#160; &#160;&#160;&#160;</p>
</p>
<p>Sorry, I&#39;m not easy enough with javascript to be sure of my code. But it works on all browser I&#39;ve tested.</p>
</p>
<p>Philippe</p>
]]></description>
        	        	<pubDate>Fri, 20 Feb 2009 01:43:10 +0200</pubDate>
        </item>
        <item>
        	<title>zchermit on Custom Cell Class</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4052</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4052</guid>
        	        	<description><![CDATA[<p>Good time of the day, Tony!</p>
<p>A small change in the code above. Call addClass functions should be done before the call formatter.<br />
In this case, formatting can be managed through the classes too. For example, turn it off in class 'unformat ':)</p>
<p>@@ -659,16 +659,17 @@<br />
 				grid.cols[k] = this;<br />
 			});<br />
 		};<br />
-		var addCell = function(t,row,cell,pos) {<br />
+		var addCell = function(t,row,cell,pos,cssp) {<br />
 			var td;<br />
 			td = document.createElement("td");<br />
-			formatter($(td,t),row,cell,pos,'add');<br />
+			if (cssp) { $(td,t).addClass(cssp); }<br />
+			formatter($(td,t),row,cell,pos,'add');<br />
 			row.appendChild(td);<br />
 			formatCol($(td,t), pos);<br />
 		};<br />
 		var formatter = function (elem, row, cellval , colpos, act){<br />
 			var cm = ts.p.colModel[colpos];<br />
-			if(cm.formatter) {<br />
+			if ( (cm.formatter) &#38;&#38; (!$(elem).hasClass('unformat')) ) {<br />
 				var opts= {rowId: row.id, colModel:cm,rowData:row};<br />
 				if($.isFunction( cm.formatter ) ) {<br />
 					cm.formatter(elem,cellval,opts,act);</p>
<p>With best wishes,<br />
Serg.</p>
]]></description>
        	        	<pubDate>Mon, 19 Jan 2009 15:33:07 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Custom Cell Class</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4024</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4024</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thenk you very much for this. I will see if I can include it in the final.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Mon, 19 Jan 2009 02:32:19 +0200</pubDate>
        </item>
        <item>
        	<title>zchermit on Custom Cell Class</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4015</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/custom-cell-class#p4015</guid>
        	        	<description><![CDATA[<p>Hi, Tony!</p>
<p>To solve my problem in jqGrid I had to be able to specify different styles for different cells. For example, draw a chess board 🙂 <br /> It would like to see such a possibility. </p>
<p>While a done like this. <br /> Implemented only for JSON. Version jqGrid 3.4 beta.</p>
<p>The idea is to expand the data yet another array of styles for each cell. In my code, this array is called the "cssp".</p>
<p>--- grid.base.js.orig&#160;&#160;&#160; Sun Jan 11 14:33:42 2009<br />+++ grid.base.js&#160;&#160;&#160; Sun Jan 18 18:53:37 2009<br />@@ -570,7 +570,7 @@<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (cssp){<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(typeof cssp == &#39;string&#39;) {$(tcell).addClass(cssp);} else {$(tcell).css(cssp);}<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />-&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(typeof attrp == &#39;object&#39;) {$(tcell).attr(cssp);}<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(typeof attrp == &#39;object&#39;) {$(tcell).attr(attrp);}<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; });<br />@@ -659,10 +659,11 @@<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; grid.cols[k] = this;<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; };<br />-&#160;&#160;&#160; &#160;&#160;&#160; var addCell = function(t,row,cell,pos) {<br />+&#160;&#160;&#160; &#160;&#160;&#160; var addCell = function(t,row,cell,pos,cssp) {<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var td;<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; td = document.createElement("td");<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; formatter($(td,t),row,cell,pos,&#39;add&#39;);&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (cssp) { $(td,t).addClass(cssp); }<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; row.appendChild(td);<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; formatCol($(td,t), pos);<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; };<br />@@ -761,7 +762,7 @@<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; };<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; var addJSONData = function(data,t, rcnt) {<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(data) { var fpos = ts.p.treeANode; rcnt = rcnt &#124;&#124; 0; if(fpos===0 &#38;&#38; rcnt===0) {$("tbody tr:gt(0)", t).remove();} }&#160; else { return; }<br />-&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var row,f=[],cur,gi=0,si=0,drows,idn,rd=[],cn=(ts.p.altRows===true) ? &#39;alt&#39;:&#39;&#39;;<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var row,f=[],cur,curcss,gi=0,si=0,drows,idn,rd=[],cn=(ts.p.altRows===true) ? &#39;alt&#39;:&#39;&#39;;<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ts.p.page = data[ts.p.jsonReader.page];<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ts.p.lastpage= data[ts.p.jsonReader.total];<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ts.p.records= data[ts.p.jsonReader.records];<br />@@ -799,9 +800,15 @@<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; si= 1;<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (ts.p.jsonReader.repeatitems === true) {<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(ts.p.jsonReader.cssp) {curcss = cur[ts.p.jsonReader.cssp];}<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(ts.p.jsonReader.cell) {cur = cur[ts.p.jsonReader.cell];}<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for (var j=0;j&#60;cur.length;j++) {<br />-&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; addCell(t,row,cur[j],j+gi+si);<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (curcss) {<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; addCell(t,row,cur[j],j+gi+si,curcss[j]);<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else {<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // if cssp does not exists - then nothing or default maybe...<br />+&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; addCell(t,row,cur[j],j+gi+si);<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; rd[ts.p.colModel[j+gi+si].name] = cur[j];<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else {<br />@@ -1184,6 +1191,8 @@<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; records: "records",<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; repeatitems: true,<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; cell: "cell",<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // CSS class for each cell<br />+&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; cssp: "cssp",<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; id: "id",<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; userdata: "userdata",<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; subgrid: {root:"rows", repeatitems: true, cell:"cell"}</p>
<p>PS. Thank you for jqGrid. He has a great future;)</p>
<p>PPS. Sorry about my English. That&#39;s all translate.google.com:)</p>
]]></description>
        	        	<pubDate>Sun, 18 Jan 2009 11:25:01 +0200</pubDate>
        </item>
</channel>
</rss>