<?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  + Reset Button Problems</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems</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-reset-button-problems/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Sorting  + Reset Button Problems</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3188</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3188</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>As of the docs parameters passed to the server are:</p>
<p>page -&#160; the requested page</p>
<p>rows - requested rows</p>
<p>sidx - the index or name of the sorted column from colModel</p>
<p>sord - the order - asc or desc</p>
</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 21 Nov 2008 04:13:59 +0200</pubDate>
        </item>
        <item>
        	<title>erickgoldner on Sorting  + Reset Button Problems</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3173</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3173</guid>
        	        	<description><![CDATA[<p>Hi Tony,</p>
<p>Before i tried you suggestion i tried to print the list and noticed that it was receving the data from database perfectly ordered. What i mean is that theres something confusing the way that the jqgrid is printing because if the list is ordered before it shows the grid, why is not after the grid is printed?</p>
<p>Anyway, I&#180;ve tried without success to pass the values :</p>
<p>sortorder = "desc";<br />sortname = "nomesetor";</p>
<p>and add it to the method wich makes the query to get the data from database.This didn&#180;t work, but i&#180;ve noticed that the values are correctly passed via the json (noticed via firebug).</p>
<p>Any other idea?</p></p>
]]></description>
        	        	<pubDate>Thu, 20 Nov 2008 07:16:07 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Sorting  + Reset Button Problems</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3159</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3159</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Also obtain the sort name and sort order server side and include this in the</p>
<p>SQL query. See docs how to do that and which parameters to use.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 19 Nov 2008 06:53:18 +0200</pubDate>
        </item>
        <item>
        	<title>erickgoldner on Sorting  + Reset Button Problems</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3145</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3145</guid>
        	        	<description><![CDATA[<p>Hi Tony, thanks for your answer !</p>
<p>For the second problem it worked perfectly! No problems anymore!</p>
<p>Now , for the first you said that i should check the server side code !</p>
<p>By that you meant the way i get the data from the database?</p>
<p>If so then the problem is here ?</p>
<p>&#160; long max = Math.min(((page - 1)* rows) + rows, setortemp.size());<br />&#160;&#160;&#160; &#160;&#160;&#160; for (int i = (int) ((page - 1)* rows); i &#60; max; i++) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; setor.add(setortemp.get(i));<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; records = setortemp.size();<br />&#160;&#160;&#160; &#160;&#160;&#160; total = Math.round(setortemp.size() / rows) + 1;</p>
<p>It&#180;s weird because the paging is working just fine. Any other idea of how i can do this?</p>
</p>
<p>Thanks</p>
]]></description>
        	        	<pubDate>Tue, 18 Nov 2008 07:24:01 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Sorting  + Reset Button Problems</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3085</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3085</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>1. For the sorting - check your server side code. In this case jqGrid</p>
<p>accept the data from server and there is nothing to do more.</p>
<p>2. Use this logic server side:</p>
<p>if( _search ==&#39;true&#39;) {</p>
<p>// perform the serch here</p>
<p>} else&#160; {</p>
<p>// reset the serch values here</p>
<p>// and return not searched data</p>
<p>}</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 15 Nov 2008 05:47:37 +0200</pubDate>
        </item>
        <item>
        	<title>erickgoldner on Sorting  + Reset Button Problems</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3078</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/sorting-reset-button-problems#p3078</guid>
        	        	<description><![CDATA[<p>Hi.. i&#180;ve been trying to use jqgrid with Struts 2 for the last 2 weeks and</p>
<p>finally succeded! I&#180;m using json for dealing the data.</p>
<p>I can now edit data and remove data but for search i had to implement my own method passing the 3 values searchField,searchOper,searchString</p>
<p>because the search from the grid wasn&#180;t working( actually i couldnt figure out if i still needed to implement something like i did or it was already suppposed to do search if the data was already loaded).</p>
<p>Now the 2 problems :</p>
<p>the first is the sorting that is not working! When you click it is sorting randomly&#160; and diffent from the previous one at every single click.</p>
<p>the second one is the reset button from the search. it is not reseting the grid. I&#180;ve already checked that when click on the reset button the _search param becames false but still shows the value from the search.</p>
<p>Here&#180;s the method that i get the data from the database:</p>
<p>public String getJSON(){<br />&#160;&#160;&#160; &#160;&#160;&#160; List&#60;Setor&#62; setortemp = null;<br />&#160;&#160;&#160; &#160;&#160;&#160; setor = new HashSet&#60;Setor&#62;();<br />&#160;&#160;&#160; &#160;&#160;&#160; if(searchField != null){&#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; setortemp = s.novaBusca(searchField, searchOper, searchString);&#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; else{&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; setortemp =&#160; s.findAll();&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; long max = Math.min(((page - 1)* rows) + rows, setortemp.size());<br />&#160;&#160;&#160; &#160;&#160;&#160; for (int i = (int) ((page - 1)* rows); i &#60; max; i++) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; setor.add(setortemp.get(i));<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; records = setortemp.size();<br />&#160;&#160;&#160; &#160;&#160;&#160; total = Math.round(setortemp.size() / rows) + 1;<br />&#160;&#160;&#160; &#160;&#160;&#160; return "json";<br />&#160;&#160;&#160; }</p>
<p>And here is the grid:</p>
<p>jQuery(document).ready(function(){<br />jQuery("#list2").jqGrid({<br />&#160;&#160;&#160; url:&#39;FetchJSON.action?nd=&#39;+new Date().getTime(),<br />&#160;&#160;&#160; datatype: "json",<br />&#160;&#160;&#160; colNames:[&#39;Id&#39;, &#39;Setor&#39;],<br />&#160;&#160;&#160; colModel:[<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;idsetor&#39;,index:&#39;idsetor&#39;, width:50, editoptions:{readonly:true,size:10}},<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;nomesetor&#39;,index:&#39;nomesetor&#39;, width:75, editable:true, editoptions:{size:10}},<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; ],<br />&#160;&#160;&#160; pager: jQuery(&#39;#pager2&#39;),<br />&#160;&#160;&#160; rowNum:10,<br />&#160;&#160;&#160; rowList:[10,20,30],<br />&#160;&#160;&#160; imgpath: &#39;themes/sand/images&#39;,<br />&#160;&#160;&#160; sortname: &#39;idsetor&#39;,<br />&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160; caption: "Teste",<br />&#160;&#160;&#160; width : 500,<br />&#160;&#160;&#160; height : "100%",&#160;&#160; <br />&#160;&#160;&#160; loadtext : "Carregando", <br />&#160;&#160;&#160; recordtext : "registros",<br />&#160;&#160;&#160; editurl: &#39;saveSetor.action&#39;,<br />&#160;&#160;&#160; jsonReader: { repeatitems : false, id : "idsetor", root:"setor"}<br />}).navGrid(&#39;#pager2&#39;,<br />&#160;&#160;&#160; {refresh: true, edit: true, add: true, del: true,search: true}, //options<br />&#160;&#160;&#160; {height:100, reloadAfterSubmit:false, url:"saveSetor.action"}, // edit options<br />&#160;&#160;&#160; {height:100, reloadAfterSubmit:true, url:"saveSetor"}, // add options<br />&#160;&#160;&#160; {reloadAfterSubmit:true, url:"RemoveJSON.action"}, // del options<br />&#160;&#160;&#160; {} // search options<br />);&#160;&#160;&#160; <br />});</p>
<p>Thanks in advance.</p>
]]></description>
        	        	<pubDate>Fri, 14 Nov 2008 10:49:44 +0200</pubDate>
        </item>
</channel>
</rss>