<?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: Custom Form with Jqgrid</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/custom-form-with-jqgrid</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/custom-form-with-jqgrid/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>rochiel on Custom Form with Jqgrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/custom-form-with-jqgrid#p24831</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/custom-form-with-jqgrid#p24831</guid>
        	        	<description><![CDATA[<blockquote>
<p>Hello 😉</p>
</p>
<p>I done this :</p>
</p>
<p>"</p>
<pre id="line118">,gridComplete: function(){		
		
var re = &#39;&#39;
var ad = &#39;&#39;
var du = &#39;&#39;
var ed = &#39;&#39;
var de = &#39;&#39;

				var ids = jQuery("#service_table").jqGrid("getDataIDs");
				for(var i=0;i &#60; ids.length;i++)
				{
					var cl = ids[i];
			
re = "&#60;div style=&#39;float:left;margin-right:1px&#39; class=&#39;ui-pg-div&#39;&#62;&#60;span style=&#39;cursor: pointer;&#39; class=&#39;ui-icon ui-icon-info&#39; title=&#39;Consulter&#39; onclick="GetserviceForm(&#39;consult&#39;, &#39;#service_table&#39;, &#39;#service_form_div_&#39;, &#39;"+cl+"&#39;);" &#62;&#60;/span&#62;&#60;/div&#62;";
ad = "&#60;div style=&#39;float:left;margin-right:1px&#39; class=&#39;ui-pg-div&#39;&#62;&#60;span style=&#39;cursor: pointer;&#39; class=&#39;ui-icon ui-icon-plus&#39; title=&#39;Ajouter&#39; onclick="GetserviceForm(&#39;add&#39;, &#39;#service_table&#39;, &#39;#service_form_div_&#39;, &#39;0&#39;);" &#62;&#60;/span&#62;&#60;/div&#62;";
du = "&#60;div style=&#39;float:left;margin-right:1px&#39; class=&#39;ui-pg-div&#39;&#62;&#60;span style=&#39;cursor: pointer;&#39; class=&#39;ui-icon ui-icon-copy&#39; title=&#39;Dupliquer&#39; onclick="GetserviceForm(&#39;duplicate&#39;, &#39;#service_table&#39;, &#39;#service_form_div_&#39;, &#39;"+cl+"&#39;);" &#62;&#60;/span&#62;&#60;/div&#62;";
ed = "&#60;div style=&#39;float:left;margin-right:1px&#39; class=&#39;ui-pg-div&#39;&#62;&#60;span style=&#39;cursor: pointer;&#39; class=&#39;ui-icon ui-icon-pencil&#39; title=&#39;Modifier&#39; onclick="GetserviceForm(&#39;edit&#39;, &#39;#service_table&#39;, &#39;#service_form_div_&#39;, &#39;"+cl+"&#39;);" &#62;&#60;/span&#62;&#60;/div&#62;";
de = "&#60;div style=&#39;float:left;margin-right:1px&#39; class=&#39;ui-pg-div&#39;&#62;&#60;span style=&#39;cursor: pointer;&#39; class=&#39;ui-icon ui-icon-trash&#39; title=&#39;Supprimer&#39; onclick="DeleteserviceRow(&#39;#service_table&#39;, &#39;"+cl+"&#39;);" &#62;&#60;/span&#62;&#60;/div&#62;";
				jQuery("#service_table").jqGrid("setRowData",cl,{grid_actions:re + ad + du + ed + de});
}

}"<br /><br />"<br /></pre>
<pre id="line118">function GetserviceForm(method, gridId, formId, rowID){			
				// les donnees pour valider le form : precedes de frm_ car le isValid prend les id des elements du form
				// on precede de l id du form car IE ne retrouve pas  
				$data = "method="+method+"&#38;id_Prestation="+rowID+"&#38;format=html";
					var ts = $(gridId + ".ui-jqgrid-btable").get(0);
			    	if(ts.grid.hDiv.loading){
			    		return;
			    	}
					beginGridRequest(gridId);
					$.ajax({
						type: "POST",
						url:baseUrl + "/index.php/manage_service-getform",
						async:true,
						data: $data,
						success: function(reponse){							
							if(reponse != null &#38;&#38; reponse != ""){							
								$(formId).empty();
								$(formId).append(reponse);
								/*$(formId).get(0).innerHTML =  reponse;*/
							}else{
								$(formId).empty();
							}
							var labelForm = titleRead;
							
							if(method == "edit"){
								labelForm = titleEdit;
							}else if(method == "add"){
								labelForm = titleAdd;
							}else if(method == "duplicate"){
								labelForm = titleDuplicate;
							}
							endGridRequest(gridId);
							$(formId)
								.dialog({bgiframe: true,
modal: true,
autoOpen: false,
height: 250,
width: 350,
buttons: {Annuler: function() {
							$("#service_form_div_").dialog("close");
							},
							Valider: function() {
								SubmitserviceForm("#service_table", "#service_form_div_");
							}}})
								.dialog({ title: labelForm })
								.dialog("open");
								
						},
						error: function(reponse, textStatus, errorThrown){
							endGridRequest(gridId);
							alert("Execution error");
						}
					});
				}; // Fin CloseForm()
			function SubmitserviceForm(gridId, formId){	
				$data ="id_Prestation="+$(formId + "id_Prestation").val()+"&#38;libelle="+$(formId + "libelle").val()+"&#38;grid_actions="+$(formId + "grid_actions").val()+"&#38;";
				var ts = $(gridId + ".ui-jqgrid-btable").get(0);
		    	if(ts.grid.hDiv.loading){
		    		return;
		    	}
			
				beginGridRequest(gridId);
				$.ajax({
					type: "POST",
					url:baseUrl + "/index.php/manage_service-check?format=html",
					async:true,
					data: $data,
					success: function(reponse){
						endGridRequest(gridId);
						if(reponse != null &#38;&#38; reponse != ""){
							// echec on affiche la reponse, qui et le zend_form avec erreurs
							$(formId).get(0).innerHTML= $(reponse).get(0).innerHTML;
						}else{
							// succes, rechargement du jqgrid et fermeture dialog avec zend_form
							jQuery(gridId).trigger("reloadGrid");
							$(formId).dialog("close");
						}
					},
					error: function(reponse, textStatus, errorThrown){
						endGridRequest(gridId);
						alert("Execution error");
					}
				});
			}; // Fin SubmitForm()
			
			/**
			 * Supprime une ligne du tableau
			 */
			function DeleteserviceRow(gridId, rowID){
				var ts = $(gridId + ".ui-jqgrid-btable").get(0);
		    	if(ts.grid.hDiv.loading){
		    		return;
		    	}
				jQuery(gridId).setSelection(rowID, false);
			    if (confirm(msgConfirmSupp)) {
			    	beginGridRequest(gridId);
			    	$.ajax({
						type: "POST",
						url: baseUrl + "/index.php/manage_service-delete-"+rowID,
						dataType:"html",
						data:"format=html",
						success: function(reponse){
							endGridRequest(gridId);
				    	    if(reponse == ""){
				    	    	jQuery(gridId).delRowData(rowID);
				    	    }else{
				    	    	alert("Suppression impossible :\n" + reponse);			    	    
				    	    }
						},
						error: function(reponse, textStatus, errorThrown){
							endGridRequest(gridId);
							alert("Execution error");
						}
					});
			    } else {
			    	jQuery(gridId).resetSelection();
			    } // if
			}; // fin DeleteRow<br />"<br /><br />It&#39;s not perfect (I&#39;ll make refactorisation of this code) but it work perfectly 🙂 (I don&#39;t like default form edition)<br /><br />Hope this help you</pre>
</p>
</blockquote>
]]></description>
        	        	<pubDate>Fri, 07 Oct 2011 09:25:00 +0300</pubDate>
        </item>
        <item>
        	<title>corneadoug on Custom Form with Jqgrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/custom-form-with-jqgrid#p24824</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/custom-form-with-jqgrid#p24824</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I want to do something, but not sure if it is possible, and how to do it...</p>
</p>
<p>1/</p>
<p>I have a grid, and i want when i select it and press button, to open a modal window, showing some informations of the grid + having new jqgrid with info into it.</p>
</p>
<p>exemple:</p>
<p>Lastname &#124;&#160; Firstname &#124; Number of adresses</p>
<p>toto&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tata&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2</p>
</p>
<p>then the modal window would be:</p>
<p>-------------------------------------------&#124;</p>
<p>&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; toto&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;</p>
<p>&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tata&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;</p>
<p>&#124; Adresses (jqgrid)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;</p>
<p>&#124;7 street zipcode city (one line text) &#124;</p>
<p>&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;</p>
<p>&#124;___________________________&#124;</p>
</p>
<p>however i dont see how to include this new jqgrid in the modal window.</p>
</p>
<p>2/</p>
<p>I want to use create on the modal window&#39;s jqgrid, and have a new EditPopUp, where i can give the number, street, city etc...</p>
<p>and not have just one line, plus i would like to use an autocomplete element for city.</p>
</p>
<p>In the end both are the same, I want to put more elements myself into the modal window created by jqgrid.</p>
<p>If it&#39;s not possible, does anybody has an idea on how we can do it using different tools or elements?</p>
</p>
<p>Thx 🙂</p></p>
]]></description>
        	        	<pubDate>Thu, 06 Oct 2011 12:28:19 +0300</pubDate>
        </item>
</channel>
</rss>