<?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: Row values do not correspond to column values</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/row-values-do-not-correspond-to-column-values</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/row-values-do-not-correspond-to-column-values/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Dr0gNan on Row values do not correspond to column values</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/row-values-do-not-correspond-to-column-values#p20956</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/row-values-do-not-correspond-to-column-values#p20956</guid>
        	        	<description><![CDATA[<p>Hi, im newbie with JSP and JqGrid, sorry for my english, i use a web translator.  I tried to implement the interface "Custom Edit" (<a rel="nofollow" href="http://trirand.com/blog/jqgrid/jqgrid.html" target="_blank"></a><a href="http://trirand.com/blog/jqgrid" rel="nofollow" target="_blank">http://trirand.com/blog/jqgrid</a>.....qgrid.html) shown as examples in the Framework page. Instead of using buttons Imagebuttons&#39;ve tried to use, but that&#39;s not the problem that does not work.  For example, data pertaining to E-mail are loaded in the previous column (Phone) and so with all the columns. If I delete the column that I added later (Actions) data is displayed correctly.  For more than review the code I can not find why, to see if you can get me out of this jam that I can not leave.  The following code handles jqGrid paint the grid and the page in general.</p>
</p>
<p><span style="text-decoration: underline;"><strong>ListadoClientes.jsp</strong></span></p>
<pre class="alt2" dir="ltr"><p><input type='button' class='sfcodeselect' name='sfselectit196' value='Select Code' data-codeid='sfcode196' /></p><div class='sfcode' id='sfcode196'>&#60;%@page contentType=&#34;text/html&#34; pageEncoding=&#34;UTF-8&#34;%&#62;<br />&#60;!DOCTYPE HTML PUBLIC &#34;-//W3C//DTD HTML 4.01 Transitional//EN&#34; &#34;http://www.w3.org/TR/html4/loose.dtd&#34;&#62;<br />&#60;html&#62;<br /> &#60;head&#62;<br /> &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; /&#62;<br /> &#60;title&#62;Listado de clientes&#60;/title&#62;<br /> <br /> &#60;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; media=&#34;screen&#34; href=&#34;css/jquery-ui-1.8.6.custom.css&#34; /&#62;<br /> &#60;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; media=&#34;screen&#34; href=&#34;css/ui.jqgrid.css&#34; /&#62;<br /><br /> &#60;script src=&#34;js/jquery.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62;<br /> &#60;script src=&#34;js/grid.locale-es.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62;<br /> &#60;script src=&#34;js/jquery.jqGrid.min.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62;<br /> &#60;script type=&#34;text/javascript&#34;&#62;<br /> $().ready(function()<br /> {<br /> var windowWidth = (document.documentElement.clientWidth - 100) /1.2;<br /><br /> jQuery(&#34;#gridClientes&#34;).jqGrid(<br /> {<br /> url:&#39;getCustomerGrid.jsp&#39;,<br /> datatype: &#34;json&#34;,<br /> colNames:[&#39;Codigo&#39;,&#39;Nombre&#39;,&#39;Apellidos&#39;,&#39;Direcci&#243;n&#39;,&#39;Tel&#233;fono&#39;,&#39;E-mail&#39;,&#39;Mierda&#39;],<br /> colModel:<br /> [<br /> {name:&#39;id&#39;,index:&#39;codcli&#39;, width:10, hidden:true},<br /> {name:&#39;Nombre1&#39;,index:&#39;nomcli1&#39;, width:150},<br /> {name:&#39;Apellidos&#39;,index:&#39;apecli&#39;, width:150},<br /> {name:&#39;Direcci&#243;n&#39;,index:&#39;dircli&#39;, width:150},<br /> {name:&#39;Tel&#233;fono&#39;,index:&#39;telcli&#39;, width:150},<br /> {name:&#39;E-mail&#39;,index:&#39;emailcli&#39;, width:150},<br /> {name:&#39;Mierda&#39;,index:&#39;apecli&#39;, width:150},<br /> ],<br /> rowNum:10,<br /> rowList:[10,20,30],<br /> multiselect: false,<br /> pager: &#39;#pagGrid&#39;,<br /> sortname: &#39;codcli&#39;,<br /> viewrecords: true,<br /> sortorder: &#34;desc&#34;,<br /> editurl: &#34;getCustomerGrid.jsp&#34;,<br /> width: windowWidth,<br /> height: &#34;100%&#34;,<br /> // nSelectRow: subGridReferenciasImagenes,<br /> caption:&#34;Clientes&#34;<br /> });<br /> <br /> jQuery(&#34;#gridClientes&#34;).jqGrid(&#39;navGrid&#39;,&#39;#pagGrid&#39;,{edit:false,add:false,del:false});<br /> });<br /> &#60;/script&#62;<br /> &#60;/head&#62;<br /> &#60;body style=&#34;background: #121212&#34;&#62;<br /> &#60;div id=&#34;Encabezado&#34; class=&#34;ui-layout-north&#34; style=&#34;padding:0px; background:#ccc&#34;&#62;<br /> &#60;div style=&#34;float:left;width: 100%; background:#9bd252; border :0px solid #ccc; height:55px&#34;&#62;<br /> &#60;div class=&#34;tituloheaderLogin&#34; style=&#34;color:#1a1a1a; padding:20px; text-align: center; font-family: sans-serif; font-weight: bold&#34; &#62;<br /> Listado de clientes<br /> &#60;/div&#62;<br /> &#60;/div&#62;<br /> &#60;div class=&#34;topBar&#34; style=&#34;background:#1c1c1c;&#34;&#62;<br /> &#60;/div&#62;<br /> &#60;/div&#62;<br /> &#60;div id=&#34;LeftPane&#34; class=&#34;ui-layout-west ui-widget ui-widget-content&#34; &#62;<br /> &#60;table id=&#34;west-grid&#34;&#62;&#60;/table&#62;<br /> &#60;/div&#62; <em>&#60;!-- #LeftPane --&#62;</em><br /> &#60;div id=&#34;RightPane&#34; class=&#34;ui-layout-center ui-helper-reset ui-widget-content&#34; &#62;<em>&#60;!-- Tabs pane --&#62;</em><br /> &#60;div id=&#34;switcher&#34;&#62;&#60;/div&#62;<br /> &#60;div id=&#34;tabs&#34; class=&#34;jqgtabs&#34;&#62;<br /> &#60;ul&#62;&#60;/ul&#62;<br /> &#60;/div&#62;<br /> &#60;div id=&#34;LogoPanel&#34; style=&#34;width:90%; border:0px solid #000;margin-left:10%;  margin-top:2%; text-align:center; &#34;&#62;<br /> &#60;table id=&#34;gridClientes&#34;&#62;&#60;/table&#62;<br /> &#60;div id=&#34;pagGrid&#34;&#62;&#60;/div&#62;<br /> &#60;/div&#62;<br /> &#60;/div&#62; <em>&#60;!-- #RightPane --&#62;</em><br /> &#60;/body&#62;<br />&#60;/html&#62;</div><br />The following code accesses to the database and load the values for display on the listing page.<br /><br /><strong><span style="text-decoration: underline;">getCustomerGrid.jsp<br /><br /></span></strong></pre>
<pre class="alt2" dir="ltr"><p><input type='button' class='sfcodeselect' name='sfselectit8752' value='Select Code' data-codeid='sfcode8752' /></p><div class='sfcode' id='sfcode8752'>&#60;%@page import=&#34;java.sql.*&#34; %&#62;<br />&#60;%@page import=&#34;classes.Conexion&#34; %&#62;<br /><br />&#60;%<br /> int start=0;<br /> int total=0;<br /> int total_pages=0;<br /> <br /> int intpage = new Integer(request.getParameter(&#34;page&#34;));<br /> int limit = new Integer(request.getParameter(&#34;rows&#34;));<br /><br /> String sidx = request.getParameter(&#34;sidx&#34;);<br /> String sord = request.getParameter(&#34;sord&#34;);<br /> String strQuery=&#34;&#34;;<br /> String json =&#34;&#34;;<br /> <br /> boolean rc;<br /> ResultSet rs = null;<br /> <br /> if(sidx ==&#34;&#34;)<br /> {<br /> sidx =&#34;1&#34;;<br /> }<br /> <br /> /*-----------------------------------Conexi&#243;n a la base de datos MySQL-------------------------------------------*/<br /> Conexion  conexiondb = new Conexion();<br /> conexiondb.Inicializar();<br /> conexiondb.Conectar();<br /> /*-----------------------------------------------------------------------------------------------------------*/<br /> <br /> total = conexiondb.countRec(&#34;codcli&#34;, &#34;cliente&#34;);<br /> <br /> if(total&#62;0)<br /> {<br /> double d = Math.ceil((double)(total) / (double)(limit));<br /> total_pages = (int)(d);<br /> }<br /> else <br /> {<br /> total_pages = 0;<br /> }<br /> <br /> if (intpage &#62; total_pages) {<br /> intpage=total_pages;<br /> }<br /> <br /> start = limit * intpage - limit; <br /> <br /> if(start &#60; 0)<br /> {<br /> start = 0;<br /> }<br /> <br /> strQuery = &#34;SELECT * FROM cliente ORDER BY &#34; + sidx + &#34; &#34; + sord + &#34; LIMIT &#34; + start + &#34; , &#34; + limit;<br /> System.out.println(strQuery);<br /> rs = conexiondb.Consulta(strQuery);<br /> <br /> total = conexiondb.countRec(&#34;codcli&#34;, &#34;cliente&#34;);<br /> <br /> response.setContentType(&#34;text/x-json&#34;);<br /> response.setHeader(&#34;Pragma&#34;, &#34;no-cache&#34;);<br /> response.setHeader(&#34;Cache-Control&#34;, &#34;no-cache, must-revalidate&#34;);<br /> response.setHeader(&#34;Pragma&#34;, &#34;no-cache&#34;);<br /> <br /> json = &#34;&#34;;<br /> json = json + &#34;{\n&#34;;<br /> json = json + &#34; \&#34;page\&#34;:\&#34;&#34; + intpage + &#34;\&#34;,\n&#34;;<br /> json = json + &#34;\&#34;total\&#34;:&#34; + total_pages + &#34;,\n&#34;;<br /> json = json + &#34;\&#34;records\&#34;:&#34; + total + &#34;,\n&#34;;<br /> json = json + &#34;\&#34;rows\&#34;: [&#34;;<br /> rc = false;<br /> <br /> while(rs.next())<br /> {<br /> if(rc)<br /> {<br /> json = json + &#34;,&#34;;<br /> }<br /> <br /> json = json + &#34;\n{&#34;;<br /> json = json + &#34;\&#34;id\&#34;:\&#34;&#34;+rs.getInt(&#34;codcli&#34;)+&#34;\&#34;,&#34;;<br /> json = json + &#34;\&#34;cell\&#34;:[&#34;+rs.getInt(&#34;codcli&#34;)+&#34;&#34;;<br /> json = json + &#34;,\&#34;&#34;+rs.getString(&#34;nomcli&#34;)+&#34;\&#34;&#34;;<br /> json = json + &#34;,\&#34;&#34;+rs.getString(&#34;apecli&#34;)+&#34;\&#34;&#34;;<br /> json = json + &#34;,\&#34;&#34;+rs.getString(&#34;dircli&#34;)+&#34;\&#34;&#34;;<br /> json = json + &#34;,\&#34;&#34;+rs.getString(&#34;telcli&#34;)+&#34;\&#34;&#34;;<br /> json = json + &#34;,\&#34;&#34;+rs.getString(&#34;emailcli&#34;)+&#34;\&#34;]&#34;;<br /> json = json + &#34;}&#34;;<br /> rc=true;<br /> }<br /> <br /> json = json +&#34;]\n&#34;;<br /> json = json +&#34;}&#34;;<br /><br /> out.print(json);<br /> out.close();<br />%&#62;</div></pre>
<p>Thank you for your help, greetings!<span style="text-decoration: underline;"><strong> 🙂</strong></span></p>
]]></description>
        	        	<pubDate>Tue, 23 Nov 2010 19:43:58 +0200</pubDate>
        </item>
</channel>
</rss>