<?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: Date Sorting in local table.</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/date-sorting-in-local-table</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/date-sorting-in-local-table/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>senrajsurendran on Date Sorting in local table.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/date-sorting-in-local-table#p25522</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/date-sorting-in-local-table#p25522</guid>
        	        	<description><![CDATA[<p>thanks a lot..... I have faced the same difficulty..... Thats fixed after following ur suggestion....... 🙂</p>
<p><img class="spSmiley" style="margin:0" title="Smile" src="/blog/wp-content/forum-smileys/sf-smile.gif" alt="Smile" /></p>
]]></description>
        	        	<pubDate>Fri, 23 Dec 2011 07:37:49 +0200</pubDate>
        </item>
        <item>
        	<title>cjm19682 on Date Sorting in local table.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/date-sorting-in-local-table#p16233</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/date-sorting-in-local-table#p16233</guid>
        	        	<description><![CDATA[<p>Brilliant, thanks for your help. Works OK as follows:</p>
<p>$("#MarkupTable").jqGrid(&#39;setColProp&#39;,&#39;Date&#39;,{sorttype:&#39;date&#39;, formatter:&#39;date&#39;, datefmt: &#39;d-m-y&#39;});</p>
</p>
<p>A few observations that might help others:</p>
<ul>
<li>I do notice that the date handling is quite fussy when datatype is "clientSide". When row content comes from HTML markup (using tableToGrid), the datefmt doesn&#39;t get used for actual formatting - that gets taken from the HTML markup, but the datefmt property is still required to make the sorting work.</li>
</ul>
<ul>
<li>Similarly, if data is imported in JSON using the &#39;addRowData&#39; function, the formatting seems to be determined by the value of newformat in the localisation file e.g. grid-locale-en.js</li>
</ul>
<ul>
<li>The demos all seem to have dates formatted as Y-m-d, which will sort correctly as string-text, so I think the date-format demo code is often incorrect and the data is only correctly sorted because the text sorting produces the same results as date sorting for the given data and configuration parameters. Definitely worth changing example formatting as this is the only way to illustrate the code working correctly.</li>
</ul>
]]></description>
        	        	<pubDate>Mon, 05 Apr 2010 01:36:51 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Date Sorting in local table.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/date-sorting-in-local-table#p16117</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/date-sorting-in-local-table#p16117</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Use the datefmt option in colModel</p>
<p><a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options" rel="nofollow" target="_blank"><a href="http://www.trirand.com/jqgridw" rel="nofollow">http://www.trirand.com/jqgridw</a>.....el_options</a></p>
</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 31 Mar 2010 19:56:27 +0300</pubDate>
        </item>
        <item>
        	<title>cjm19682 on Date Sorting in local table.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/date-sorting-in-local-table#p16015</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/date-sorting-in-local-table#p16015</guid>
        	        	<description><![CDATA[<p>I have a date sorting problem I can&#39;t work around. I can&#39;t make date formatting and sorting work together. I can get the sorting to work, and I can get the formatting to work. But when I try to sort dates in format "d/m/y" they sort as strings.</p>
<p>I use jqGrid 3.6.4, and the problem occurs with both jQ 1.4.2(jQueryUI 1.8) and 1.3.2(jQueryUI 1.7.2). I am pretty confident I have downloaded the appropriate modules.</p>
<p>I changed the date format in grid.locale-en.js to:</p>
<p>&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; srcformat: "Y-m-d",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;newformat: "d/m/y",</p>
<p>When sorting by date, 4 Oct 2010 should be at the bottom of the list.</p>
<p>NB I actually want to make this work within <strong>tableToGrid</strong>. I can&#39;t make it work there, but I thought if it can be fixed here then it should be OK to use from within tableToGrid</p>
</p>
<p>Does anyone have any ideas?</p>
</p>
<p>Here&#39;s the code.</p>
</p>
<p>&#60;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&#62;<br />&#60;html&#62;<br />&#160;&#160; &#160;&#60;head&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;title&#62;Table Testbed&#60;/title&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/south-street/jquery-ui.css"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&#62;&#60;/script&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&#62;&#60;/script&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;link rel="stylesheet" type="text/css" href="/thirdParty/jqGrid/ui.jqgrid.css" &#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;script type="text/javascript" src="/thirdParty/jqGrid/grid.locale-en.js"&#62;&#60;/script&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;script type="text/javascript" src="/thirdParty/jqGrid/jquery.jqGrid.min.js"&#62;&#60;/script&#62;</p>
<p>&#160;&#160; &#160;&#160;&#160; &#160;&#60;style type="text/css"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;body {font-size: 62.5%; }<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;/style&#62;</p>
<p>&#160;&#160; &#160;&#160;&#160; &#160;&#60;script type="text/javascript"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;$().ready(function()<br />&#160;&#160; &#160;&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$("#Table_JSON").jqGrid(<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;caption: "Manipulating Array Data - JSON",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;datatype:&#160;&#160; &#160;"local",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;sortable:&#160;&#160; &#160;true,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;colNames:&#160;&#160; &#160;[&#39;Inv No&#39;,&#39;Date&#39;, &#39;Client&#39;, &#39;Amount&#39;,&#39;Tax&#39;,&#39;Total 2&#39;,&#39;Notes&#39;],<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;colModel:&#160;&#160; &#160;[<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;{name:&#39;id&#39;,index:&#39;id&#39;, width:160, sorttype:"int"},<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;{name:&#39;invdate&#39;,index:&#39;invdate&#39;, width:110, formatter:&#39;date&#39;, sorttype:"date"},<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;{name:&#39;name&#39;,index:&#39;name&#39;, width:100},<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;{name:&#39;amount&#39;,index:&#39;amount&#39;, width:80, align:"right",sorttype:"float"},<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;{name:&#39;tax&#39;,index:&#39;tax&#39;, width:80, align:"right", sorttype:"float", formatter:&#39;currency&#39; },<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;{name:&#39;total&#39;,index:&#39;total&#39;, width:80,align:"right",sorttype:"float"},<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;{name:&#39;note&#39;,index:&#39;note&#39;, width:150, sortable:false}<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;});<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var mydata = [<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{id:"1",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"1000",total:"210"},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{id:"10",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20",total:"320"},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{id:"3",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30",total:"430"},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{id:"4",invdate:"2010-10-04",name:"test",note:"note",amount:"200.00",tax:"10",total:"210"},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{id:"5",invdate:"2007-10-05",name:"test2",note:"this is a longer note2",amount:"300.00",tax:"20",total:"320"},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{id:"6",invdate:"2007-9-06",name:"test3",note:"note3",amount:"400.00",tax:"30",total:"430"}];<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;for(var i=0;i&#60;=mydata.length;i++)<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$("#Table_JSON").jqGrid(&#39;addRowData&#39;,i+1,mydata[i]); <br />&#160;&#160; &#160;&#160;&#160; &#160;});<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;/script&#62;</p>
<p>&#160;&#160; &#160;&#60;/head&#62;<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;&#60;body&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;table id="Table_JSON"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;/table&#62;<br />&#160;&#160; &#160;&#60;/body&#62;<br />&#60;/html&#62;</p>
]]></description>
        	        	<pubDate>Sun, 28 Mar 2010 21:47:42 +0300</pubDate>
        </item>
</channel>
</rss>