<?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: Problem with the event of jqgrid afterSubmit</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/problem-with-the-event-of-jqgrid-aftersubmit</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/problem-with-the-event-of-jqgrid-aftersubmit/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>javiut on Problem with the event of jqgrid afterSubmit</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/problem-with-the-event-of-jqgrid-aftersubmit#p25563</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/problem-with-the-event-of-jqgrid-aftersubmit#p25563</guid>
        	        	<description><![CDATA[<p>hi Guys i am facing a similar problem. here it&#39;s my code..</p>
<p>var gr = jQuery(&#39;#mainexecutivesg&#39;).jqGrid(&#39;getGridParam&#39;,&#39;selrow&#39;);</p>
<p>if(gr!= null){jQuery(&#39;#mainexecutivesg&#39;).jqGrid(&#39;editGridRow&#39;,gr,{/*afterSubmit:function(response,postdata){alert(response.responseText);},*/top:50,left:400,width:420,height:550,processData:"Editando Data En Servidor Remoto...",reloadAfterSubmit:false,closeAfterEdit:true,closeAfterAdd:true});else alert("Debes Seleccionar Una Registro Primero");}catch(E){alert(E);}}</p>
<p>as you can see.. everything is OK. but when uncommment the aftersubmit callback. the form doesn&#39;t dissapear after the response from the server(seems useless..[closeAfterEdit:true,closeAfterAdd:true])... &#160;what i am doing wrong...</p>
</p>
<p>other problem i am facing. it&#39;s i have the first column editable:false when i make the ajax call to edit that row.. the plugin change my cell value for a consecutive ID. namely (1,2,3,4).. what&#39;s that??</p>
<p>thanks <img class="spSmiley" style="margin:0" title="Embarassed" src="/blog/wp-content/forum-smileys/sf-embarassed.gif" alt="Embarassed" /></p></p>
]]></description>
        	        	<pubDate>Mon, 02 Jan 2012 22:24:05 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on Problem with the event of jqgrid afterSubmit</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/problem-with-the-event-of-jqgrid-aftersubmit#p19504</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/problem-with-the-event-of-jqgrid-aftersubmit#p19504</guid>
        	        	<description><![CDATA[<p>You use /jqgridwiki/doku.php?id=wiki:navigator</p>
<p>Best regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Thu, 02 Sep 2010 23:56:52 +0300</pubDate>
        </item>
        <item>
        	<title>larosal on Problem with the event of jqgrid afterSubmit</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/problem-with-the-event-of-jqgrid-aftersubmit#p19499</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/problem-with-the-event-of-jqgrid-aftersubmit#p19499</guid>
        	        	<description><![CDATA[<div id="forum_ctl01_MessageList_ctl00_DisplayPost1_MessagePost1">Hello</p>
<p>Someone could tell me why afterSubmit event, does not work with inserting and updating?</p>
<p>Sorry for my English</p>
<p>Here, it&#39;s&#160;a portion of Javascript:</p>
<p>jQuery(document).ready(function(){ <br />jQuery("#articulos").jqGrid({<br />url:&#39;articulos_select.php&#39;,<br />datatype: &#39;json&#39;,<br />mtype: &#39;GET&#39;,<br />colNames:[&#39;No.&#39;,&#39;Descripci&#243;n&#39;,&#39;Factura&#39;,&#39;U.Medida&#39;,&#39;Cantidad&#39;,&#39;Precio&#39;,&#39;Partida&#39;,&#39;Estatus&#39;,&#39;Caducidad&#39;],<br />colModel :[ <br />{name:&#39;no_articulo&#39;,index:&#39;no_articulo&#39;,key:true,width:30,align:&#39;right&#39;,resizable:false,editable:false,editoptions:{readonly:true,size:10},search:false},<br />{name:&#39;desc_articulo&#39;,index:&#39;desc_articulo&#39;,width:300,align:&#39;left&#39;,resizable:true,editable:true,editrules:{required:true},editoptions:{size:10},searchoptions:{sopt:[&#39;bw&#39;]}},<br />{name:&#39;fec_factura&#39;,index:&#39;fec_factura&#39;,width:80,align:&#39;right&#39;,resizable:false,editable:true,datefmt:&#39;dd-mm-yyyy&#39;,editrules:{required:true,date:true},search:false},<br />{name:&#39;unidad_medida&#39;,index:&#39;unidad_medida&#39;,width:80,align:&#39;left&#39;,resizable:true,editable:true,edittype:"select",editrules:{required:true},editoptions:{dataUrl:&#39;selects.php?q=5&#39;},search:false},<br />{name:&#39;cantidad&#39;,index:&#39;cantidad&#39;,width:70,align:&#39;right&#39;,resizable:false,editable:true,editrules:{required:true,integer:true,minValue:0,maxValue:999999},editoptions:{size:10},search:false},<br />{name:&#39;precio&#39;,index:&#39;precio&#39;,width:50,align:&#39;right&#39;,resizable:false,editable:true,editrules:{required:true,number:true,minValue:0,maxValue:99999.99},editoptions:{size:10},search:false},<br />{name:&#39;partida&#39;,index:&#39;partida&#39;,width:195,align:&#39;left&#39;,resizable:true,editable: true,edittype:"select",editrules:{required:true},editoptions:{dataUrl:&#39;selects.php?q=1&#39;},search:false},<br />{name:&#39;estatus&#39;,index:&#39;estatus&#39;,width:55,align:&#39;left&#39;,resizable:false,editable: true,edittype:"select",editoptions:{value:"A:Activo;N:Inactivo"},search:false},<br />{name:&#39;fec_caducidad&#39;,index:&#39;fec_caducidad&#39;,width:90,align:&#39;right&#39;,resizable:false,editable:true,datefmt:&#39;dd-mm-yyyy&#39;,editrules:{required:true,date:true},search:false},<br />],<br />pager:&#39;#articulos1&#39;,<br />rowNum:10,<br />rowList:[10,20,30],<br />sortname:&#39;no_articulo&#39;,<br />sortorder:&#39;asc&#39;,<br />viewrecords:true,<br />caption:&#39;ART&#205;CULOS&#39;,<br />editurl:&#39;articulos_movtos.php&#39;,<br />height:&#39;auto&#39;,<br />multiselect:true<br />}); <br />jQuery("#articulos").jqGrid(&#39;navGrid&#39;,&#39;#articulos1&#39;,<br />{}, //options<br />&#39;editGridRow&#39;,&#39;selrow&#39;,{height:280,reloadAfterSubmit:false,<br />afterSubmit: function(response, postdata) { <br />if (response.responseText == "") { <br />return [true, response.responseText] <br />} <br />else { <br />return [false, response.responseText] <br />} <br />}<br />}, // edit options<br />&#39;editGridRow&#39;,&#39;new&#39;,{height:280,reloadAfterSubmit:false,<br />afterSubmit: function(response, postdata) { <br />if (response.responseText == "") { <br />return [true, response.responseText] <br />} <br />else { <br />return [false, response.responseText] <br />} <br />}<br />},// add options<br />&#39;delGridRow&#39;,&#39;selarrow&#39;,{reloadAfterSubmit:false,<br />afterSubmit: function(response, postdata) { <br />if (response.responseText == "") { <br />return [true, response.responseText] <br />} <br />else { <br />return [false, response.responseText] <br />} <br />}<br />}, // del options<br />{multipleSearch:true} // search options<br />);<br />jQuery("#articulos").setGridParam({postData: {search:true, searchField:&#39;desc_articulo&#39;, searchOper:&#39;bw&#39;},page:1}).trigger("reloadGrid");<br />}); </p>
<p>And this is a PHP code:</p>
<p>&#60;?php<br />include_once ("conexion.php"); <br />include("php/JSON.php");</p>
<p>$json = new Services_JSON();</p>
<p>//Conexi&#243;n a MySQL y a la BD<br />$Conexion=new Conexion();<br />$Conexion-&#62;getConexion();</p>
<p>$oper = $_POST[&#39;oper&#39;];<br />switch($oper){<br />case &#39;add&#39;:<br />//Insertar en la tabla Art&#237;culos <br />$sql="SELECT MAX(no_articulo) + 1 AS no_articulo FROM articulos";<br />$result = mysql_query($sql) or die (mysql_error());<br />$articulos_row=mysql_fetch_array($result);<br />if ($articulos_row[&#39;no_articulo&#39;]==&#39;&#39;){<br />$no_articulo=1;<br />}<br />else{<br />$no_articulo=$articulos_row[&#39;no_articulo&#39;];<br />} </p>
<p>$desc_articulo=$_POST[&#39;desc_articulo&#39;];<br />$unidad_medida=$_POST[&#39;unidad_medida&#39;];<br />$fec_factura1=$_POST[&#39;fec_factura&#39;];<br />$fecha = split("-",$fec_factura1);<br />$fec_factura=$fecha[2].&#39;-&#39;.$fecha[1].&#39;-&#39;.$fecha[0];<br />$cantidad=$_POST[&#39;cantidad&#39;];<br />$precio=$_POST[&#39;precio&#39;];<br />$partida=$_POST[&#39;partida&#39;];<br />$estatus=$_POST[&#39;estatus&#39;];<br />$fec_caducidad1=$_POST[&#39;fec_caducidad&#39;];<br />$fecha = split("-",$fec_caducidad1);<br />$fec_caducidad=$fecha[2].&#39;-&#39;.$fecha[1].&#39;-&#39;.$fecha[0];</p>
<p>$sql="INSERT INTO articulos (no_articulo, desc_articulo, fec_factura, unidad_medida, cantidad, precio, partida, estatus, fec_caducidad, usuario_modif) VALUES "; <br />$sql.="(".$no_articulo.",&#39;".$desc_articulo."&#39;,&#39;".$fec_factura."&#39;,".$unidad_medida.",".$cantidad.",".$precio.",".$partida.",&#39;".$estatus."&#39;,&#39;".$fec_caducidad."&#39;,&#39;".$_SESSION[&#39;name_usuario&#39;]."&#39;)";<br />$result = mysql_query($sql) or die (mysql_error());</p>
<p>//Cierra la conexi&#243;n<br />$Conexion-&#62;Close();<br />break;<br />case &#39;edit&#39;:<br />$no_articulo = (isset($_REQUEST[&#39;id&#39;]) ? trim($_REQUEST[&#39;id&#39;] ): null);<br />$result = mysql_query("SELECT COUNT(*) AS count FROM requisicion_h WHERE articulo = $no_articulo");<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];<br />mysql_free_result($result);<br />if($count == 0) {<br />$result = mysql_query("SELECT COUNT(*) AS count FROM vales_h WHERE articulo = $no_articulo");<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];<br />mysql_free_result($result);<br />if($count == 0) {<br />//Actualizar en la tabla Art&#237;culos <br />$desc_articulo=$_POST[&#39;desc_articulo&#39;];<br />$fec_factura1=$_POST[&#39;fec_factura&#39;];<br />$fecha = split("-",$fec_factura1);<br />$fec_factura=$fecha[2].&#39;-&#39;.$fecha[1].&#39;-&#39;.$fecha[0];<br />$unidad_medida=$_POST[&#39;unidad_medida&#39;];<br />$cantidad=$_POST[&#39;cantidad&#39;];<br />$precio=$_POST[&#39;precio&#39;];<br />$partida=$_POST[&#39;partida&#39;];<br />$estatus=$_POST[&#39;estatus&#39;];<br />$fec_caducidad1=$_POST[&#39;fec_caducidad&#39;]; <br />$fecha = split("-",$fec_caducidad1);<br />$fec_caducidad=$fecha[2].&#39;-&#39;.$fecha[1].&#39;-&#39;.$fecha[0];</p>
<p>$sql="UPDATE articulos SET desc_articulo = &#39;".$desc_articulo."&#39;,";<br />$sql.=" unidad_medida = ".$unidad_medida.","; <br />$sql.=" fec_factura = &#39;".$fec_factura."&#39;,";<br />$sql.=" cantidad = ".$cantidad.",";<br />$sql.=" precio = ".$precio.",";<br />$sql.=" partida = ".$partida.",";<br />$sql.=" estatus = &#39;".$estatus."&#39;,";<br />$sql.=" fec_caducidad = &#39;".$fec_caducidad."&#39;,";<br />$sql.=" usuario_modif = &#39;".$_SESSION[&#39;name_usuario&#39;]."&#39; "; <br />$sql.="WHERE no_articulo = $no_articulo";<br />$result = mysql_query($sql) or die (mysql_error());<br />} else {<br />echo "Todavia hay registros de los articulos en los vales&#60;br&#62;";<br />} <br />} else {<br />echo "Todavia hay registros de los articulos en las solicitudes&#60;br&#62;";<br />}<br />//Cierra la conexi&#243;n<br />$Conexion-&#62;Close(); <br />break;<br />case &#39;del&#39;:<br />{</p>
<p>$no_articulo = (isset($_REQUEST[&#39;id&#39;]) ? trim($_REQUEST[&#39;id&#39;] ): null);<br />$total=count(explode(&#39;,&#39;,$no_articulo));<br />$no_articulo1=explode(&#39;,&#39;,$no_articulo);<br />for($i=0;$i&#60;$total;$i++){<br />$result = mysql_query("SELECT COUNT(*) AS count FROM requisicion_h WHERE articulo = $no_articulo1[$i]");<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];<br />mysql_free_result($result);<br />if($count == 0) {<br />$result = mysql_query("SELECT COUNT(*) AS count FROM vales_h WHERE articulo = $no_articulo1[$i]");<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];<br />mysql_free_result($result);<br />if($count == 0) { <br />$sql="DELETE FROM articulos WHERE no_articulo = $no_articulo1[$i]"; <br />$result = mysql_query($sql) or die (mysql_error());<br />} else {<br />echo "Todavia hay registros de los articulos en los vales&#60;br&#62;";<br />}<br />} else {<br />echo "Todavia hay registros de los articulos en las solicitudes&#60;br&#62;";<br />}<br />}</p>
<p>//Cierra la conexi&#243;n<br />$Conexion-&#62;Close(); <br />}<br />} <br />?&#62;</p>
<p>Thanks a lot</p>
</div>
]]></description>
        	        	<pubDate>Thu, 02 Sep 2010 22:47:18 +0300</pubDate>
        </item>
</channel>
</rss>