<?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: Sort Types</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types</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/sort-types/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>MarkC on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12858</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12858</guid>
        	        	<description><![CDATA[<p>Hi Mark,</p>
<p>Yes i agree, but the way i was designing the datbase each grid column will also have a datatype field associated to it e.g.</p>
<p>col1 varchar(40)<br />col1datatype char(1)<br />col2 varchar(24)<br />col2datatype char(1)<br />.<br />.<br />. and so on</p>
<p>where the datatype is I,T,F,D (integer,text,float,Date). This allows the main data table of 200,000 records to all be VARCHAR(40) but sorted by a particlaur type. (presuming data is valid!!!!) by casting.</p>
<p>So i will interpret the I,T,F,D on the server side and SQL CAST() it, it will then be in the correct form for the grid so no need to use sorttype.</p>
<p>For a one off project i would just define the datatypes at the datbase level, but this is supposed to be a generic design of upto 20 columns each column having different types of data...and as i mentioned earlier there is a CATEGORY field, and col1 for categoryA could be a date, but col1 for categoryB could be an integer....hence the &#39;warpping of teh data in a VARCHAR(40)</p>
<p>Thanks for the guidance once again....when i eventually get paid for this i&#39;ll have to donate some beer money!!!</p>
<p>Regards</p>
<p>MarkC</p></p>
]]></description>
        	        	<pubDate>Wed, 09 Dec 2009 00:39:20 +0200</pubDate>
        </item>
        <item>
        	<title>markw65 on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12857</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12857</guid>
        	        	<description><![CDATA[<p>If you have 200000 records, the "local" approach isnt going to work (even 10,000 would be a stretch).</p>
</p>
<p>So I think you&#39;ll have to send the sort-type to the host, and sort there...</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Wed, 09 Dec 2009 00:24:22 +0200</pubDate>
        </item>
        <item>
        	<title>MarkC on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12856</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12856</guid>
        	        	<description><![CDATA[<p>I have grasped the &#39;local&#39; sorttype concept now. I tested loading 20 records of type TEXT (defined in database) and set it to sorttype:&#39;int&#39; with with datatype: &#39;local&#39;, refreshed grid and it was sorted as if it was integer.</p>
</p>
<p>But, i am using 200,000 records (LIMIT 20 at a time SQL) with scroll:true, so no paging.</p>
<p>Is it possible to switch between &#39;local&#39; and &#39;xml&#39; when we start scrolling, similar to when we start paging (onPaging). So as we scroll and retrieve the xml data, when it stops, i set it to local, refresh grid and data takes on the from of an integer again.</p>
<p>Also, i am filterng the data by searching on keypress, so would have to do something similar , switch to XML when keypressed get data, swicth back to local,refresh grid.</p>
</p>
<p>Regards</p>
<p>MarkC</p>
]]></description>
        	        	<pubDate>Wed, 09 Dec 2009 00:16:19 +0200</pubDate>
        </item>
        <item>
        	<title>MarkC on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12854</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12854</guid>
        	        	<description><![CDATA[<p>Thanks Tony,</p>
<p>I will have a look.</p>
<p>I am using scrolling not paging as we are talkng about 200,000 records and i am allowing the user to auto incremtn search on keypressing. (like your bigset.php demo)</p>
<p>But i&#39;ll have a look into the local setting.</p>
<p>regards</p>
<p>MarkC</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 23:32:17 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12847</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12847</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I think that you maybe should look here:</p>
<p><a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:howto_grid_base#client_side_sorting_but_server_side_paging" rel="nofollow" target="_blank"><a href="http://www.trirand.com/jqgridw" rel="nofollow">http://www.trirand.com/jqgridw</a>.....ide_paging</a></p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 21:11:53 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12844</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12844</guid>
        	        	<description><![CDATA[<p>Hello Mark C.,</p>
<p>I Think that Mark catch the problem in the right way.</p>
<p>In order to perform sorting client side you should set the datatype to local. Just test it</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 20:55:03 +0200</pubDate>
        </item>
        <item>
        	<title>MarkC on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12843</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12843</guid>
        	        	<description><![CDATA[<p>Hi MarkW,</p>
</p>
<p>Will have a look at your suggestions.</p>
<p>Regards</p>
<p>Mark C.</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 20:47:08 +0200</pubDate>
        </item>
        <item>
        	<title>MarkC on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12842</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12842</guid>
        	        	<description><![CDATA[<p>I can do it at SQL level:</p>
<p>strSQL = "SELECT DOCID,CAST(INDEX1 AS SIGNED) as index1,INDEX2 FROM DOCUMENTS " &#38;strWhere <br />strSQL = strSQL &#38; " ORDER BY "&#38;strIdx&#38;" "&#38;strOrd&#38;" LIMIT "&#38;strStart&#38;" , "&#38;strLimit&#38;" "</p>
</p>
<p>this takes VARCHAR(20) INDEX1 and casts it into an signed integer, so when ordering it will be corectly sorted like an integer.</p>
</p>
<p>Works fine. BUt i thought the grid would do it using sorttype!!!</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 20:45:58 +0200</pubDate>
        </item>
        <item>
        	<title>markw65 on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12841</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12841</guid>
        	        	<description><![CDATA[<p>Hi Mark,</p>
</p>
<p>I think your problem is on the server side. sorttype only applies to local sorting, and I dont think you&#39;re using that (you /could/, by fetching all the data, and then switching to datatype: "local", but you didnt mention that).</p>
</p>
<p>So you need to look at your sort code on the server. I think what you need is to add the datatype to postdata in a beforeRequest handler.</p>
</p>
<p>Basically, in your beforeRequest handler, look up the sorttype for the sort column, and add that to postdata (any name you like), and then modify you SQL to sort according to that...</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 20:45:58 +0200</pubDate>
        </item>
        <item>
        	<title>MarkC on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12839</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12839</guid>
        	        	<description><![CDATA[<p>My colModel is fine, {name:&#39;col1&#39;, index:&#39;index1&#39;, align:&#39;right&#39;, sorttype:&#39;int&#39;, sortable:true, width:80}</p>
</p>
<p>Simply...what is sorttype? maybe it&#39;s not what i thought it was, as in take any data and sort it like it was an integer?</p>
<p>The reason i get a sorted column like</p>
<p>1<br />10<br />2<br />2000<br />300</p>
<p>is that the SQL has already sorted the data based on it&#39;s datatype (VARCHAR) This is then parsed into the XML cells. EWhixh is then displayed in the grid. I thought the sorttype might do something with teh xml ordering, by saying now define it as an integer even though it is a varchar. Basically, sort a VARCHAR as if it was an integer to get 1,2,10,300,2000, hence my first question why use sorttype if it has already been sorted as a varcgar,data,integer,float by the SQL:</p>
<p>strSQL = "SELECT DOCID,INDEX1,INDEX2 FROM DOCUMENTS " &#38;strWhere <br />strSQL = strSQL &#38; " ORDER BY "&#38;strIdx&#38;" "&#38;strOrd&#38;" LIMIT "&#38;strStart&#38;" , "&#38;strLimit&#38;" "</p>
<p>and parsed into XML in that order.</p>
<p>Regards</p>
<p>MarkC</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 20:38:04 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12837</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12837</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Could you please post the entry jqGrid options(including colModel and etc) - without modifications.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 20:09:24 +0200</pubDate>
        </item>
        <item>
        	<title>MarkC on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12836</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12836</guid>
        	        	<description><![CDATA[<p>Hi Tony,</p>
<p>Yes i am using sorttype: &#39;int&#39;</p>
<p>Maybe my post was too long winded...simply put....</p>
<p>If you have a column that in MySQL is defined as varchar(10) and it holds some data say 5 records&#160; 1,2,10,2000,300. Then sorting this as text (its natural datatype varchar) you get 1,10,2,2000,300 which is correct.</p>
<p>But without changing the datatype in the MySQL table, i want to sort it has if it was an integer, resulting in: 1,2,10,300,2000 which i thought i could do by setting sorttype: &#39;int&#39; on the column. I tried that but I still get 1,10,2,2000,300 (as if it was still text).</p>
<p>As i mentioned it&#39;s like casting text data to integer data (presuming the text data is valid and contains 0-9 characters)</p>
<p>Regards</p>
<p>MarkC</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 20:01:57 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12828</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12828</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Not sure, but you define SORTTYPE, you should sorttype :&#39;int&#39;</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 18:27:05 +0200</pubDate>
        </item>
        <item>
        	<title>MarkC on Sort Types</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sort-types#p12808</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sort-types#p12808</guid>
        	        	<description><![CDATA[<p>Hi Mark/Tony</p>
<p>(Using MySQL-&#62;ASP-&#62;XML)</p>
<p>I am doing a project to define the grid from a database (like a grid contruction kit, with a backend). The data table to fill the grid will initially have 3 fields called col1,col2,col3 they will all be VARCHAR(30). We are not concerned with the datatype in the table it could be dates, integers, text, floats all wrapped around a varchar (you&#39;ll see why later)</p>
<p>All is working fine and indexing/sorting correctly based on text sorttype. Now i&#39;m trying to define datatypes at grid level. (presume data is correct for now e.g. integer will only have strings of 0to9)</p>
<p>My next step is to allow col1,col2,col3 to be associated as integer/text/date in the backend database, so even though they are defined as VARCHAR(30) in the database, i thought i could use SORTTYPE to define how they are sorted at grid level.</p>
<p>For example: if col1 has 3 records with data:</p>
<p>1<br />10<br />2</p>
<p>When SORTTYPE set to INT, i was expecting</p>
<p>1<br />2<br />10</p>
<p>even though the data at database level is varchar</p>
<p>But i still get 1,10,2.</p>
<p>Is this possible, do i need to look at formatter module,to cast Varchars into a different type for sorting. Any advice or steering in the right direction would be helpful.</p>
<p>--</p>
<p>The reason i am not defining the datatypes at database level, is eventually this needs to be a generic system with upto 7 columns all based around a CATEGORY, each category will have a different set of data e.g. col1 could be an integer for categoryA, but col1 for CategoryB could be TEXT...and so on. SO i thought define them as Varchars and handle the types at grid level if possible. All the data is held in one table and when a user selects a category (dropdown combo) it reloads the grid framework and data defined by the currently selected category.</p>
<p>Regards</p>
<p>Mark C</p>
]]></description>
        	        	<pubDate>Tue, 08 Dec 2009 05:03:08 +0200</pubDate>
        </item>
</channel>
</rss>