<?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: sorting date values with alternative display format</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format</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/help/sorting-date-values-with-alternative-display-format/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on sorting date values with alternative display format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1419</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1419</guid>
        	        	<description><![CDATA[<p>Thanks David,</p>
<p>Fixed.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 06 Aug 2008 03:18:53 +0300</pubDate>
        </item>
        <item>
        	<title>daviddlyman on sorting date values with alternative display format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1415</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1415</guid>
        	        	<description><![CDATA[<p>Tony,</p>
<p>I spoke too soon. Your suggestion seemed to work, but I just realized that sorting was only functioning for certain cases where my displayed date values in the visible column are all the same year. Since I am not displaying year, I still cannot properly sort values from multiple years. The grid is correctly sorting by the hidden column at first, but not when I click the visible date column.</p>
<p>The SortArrayData() function for client-side data sets the column to be sorted based on ts.p.lastsort. In other words, it does not care about sortname. Do you have a suggestion for sorting a "local" dataset against the data in a column other than the one that is clicked?</p>
<p>Thanks,</p>
<p>David</p>
]]></description>
        	        	<pubDate>Wed, 06 Aug 2008 02:28:12 +0300</pubDate>
        </item>
        <item>
        	<title>daviddlyman on sorting date values with alternative display format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1383</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1383</guid>
        	        	<description><![CDATA[<p>Excellent! That seems to work perfectly. Thanks a million!</p>
]]></description>
        	        	<pubDate>Mon, 04 Aug 2008 10:47:20 +0300</pubDate>
        </item>
        <item>
        	<title>tony on sorting date values with alternative display format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1338</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1338</guid>
        	        	<description><![CDATA[<p>You can do that easy.</p>
<p>Use onSortCol (this event fires before sorting)</p>
<p>onSortCol : function (colname, colindex) {</p>
<p>if(colname == "visible_col") {</p>
<p>$("#mygrid").setGridParam({sortname:"hidden_col"});</p>
<p>//no need to use triger reloadgrid</p>
<p>}</p>
<p>}</p>
<p>The only missing part here is a sorting image</p>
</p>
<p>jqGrid is flexible <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/plugins/simple-forum/tinymce/plugins/emotions/img/smiley-wink.gif" border="0" alt="Wink" /></p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Thu, 31 Jul 2008 03:51:21 +0300</pubDate>
        </item>
        <item>
        	<title>daviddlyman on sorting date values with alternative display format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1335</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1335</guid>
        	        	<description><![CDATA[<p>Tony,</p>
<p>Thanks for the tip on using afterInsertRow for applying a formatting function to my data.</p>
<p>The sorting issue is definitely the tougher one to overcome, although I am hoping it is not too bad. I think that the easiest solution is to allow the sort event for a given column to key off of the data in another column. In my case, I have created a hidden column with the date values as milliseconds. If I could tell the visible date column to sort based on the values of the hidden column instead of the values in the column I click, my problems would be solved.</p>
<p>Thanks,</p>
<p>David</p>
]]></description>
        	        	<pubDate>Wed, 30 Jul 2008 15:55:28 +0300</pubDate>
        </item>
        <item>
        	<title>tony on sorting date values with alternative display format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1329</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1329</guid>
        	        	<description><![CDATA[<p>David,</p>
<p>Thank you for this. One of the big difference between jqGrid and others is the speed. This property is at first place. But having this we do not have a ton of other properies that nobody will use. We have a methods for customising this - i.e with a little programing you can achieve this. I recommend you to use afterInsertRow event and setCell method. The only thinng that you should do is to write your own date formater. The code should something like this:</p>
<p>afterInsertRow : function(rowid, datarow) {</p>
<p>// here is the code to format your date something like</p>
<p>mynewdate = customfunc(datarow.mydate);</p>
<p>$(&#8221;#mygrid&#8221;).setCell(rowid,&#39;mydate&#39;,mynewdate);</p>
<p>}</p>
<p>The clear solution here is that the date should be formated server side</p>
<p>Now about the sorting. Currently jqGrid support sorting of dates only if they are numbers. I think that this shuld be corrected and mybe will be done soon.</p>
<p>Best Regards</p>
<p>Tony</p></p>
]]></description>
        	        	<pubDate>Wed, 30 Jul 2008 06:11:48 +0300</pubDate>
        </item>
        <item>
        	<title>daviddlyman on sorting date values with alternative display format</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1325</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-date-values-with-alternative-display-format#p1325</guid>
        	        	<description><![CDATA[<p>Tony and all,</p>
<p>Great work on JQGrid! I have recently adopted JQuery and JQGrid (among other plug-ins) to replace Component Art and MSAJAX from our ASP.NET site (<a href="http://nutshellmail.com" target="_blank">http://nutshellmail.com</a>). Our code is getting cleaner and performance is definitely far better.</p>
<p>There is one limitation with JQGrid that I am hoping you can help me overcome. I have a date field in the grid that I want formatted as "ddd M/D h:mm TT" (i.e. "Tue 7/29 2:01 PM"). However, I also want this column to be sortable. Unfortunately, I am unsure if/how I can accomplish this goal.</p>
<p>I am currently using datatype: "local" and generating my own array from a JSON response. I already have the date format in milliseconds since Jan 1, 1970 and am passing it into the data array. I am then pointing the column index to that field, but still no luck.</p>
<p>ComponentArt and ExtJS Grid both support the ability tie a rendering function to each column (see the definition for Ext <a href="http://extjs.com/deploy/ext/docs/output/Ext.grid.ColumnModel.html#setRenderer" target="_blank">here</a>).</p>
<p>Can you please suggest a way that I can display the date format as "Tue 7/29 2:01 PM" while still maintaining the ability to sort?</p>
</p>
<p>Thanks,</p>
<p>David</p>
]]></description>
        	        	<pubDate>Tue, 29 Jul 2008 14:34:39 +0300</pubDate>
        </item>
</channel>
</rss>