<?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: Intercepting ESC key in inline Mode : Done</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/intercepting-esc-key-in-inline-mode-done</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/intercepting-esc-key-in-inline-mode-done/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>josepk on Intercepting ESC key in inline Mode : Done</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/intercepting-esc-key-in-inline-mode-done#p967</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/intercepting-esc-key-in-inline-mode-done#p967</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I am adding the full grid.inlinedit.js becouse can it be difficult for newbies to</p>
<p>modify this.</p>
<p>I add too the call to the edit row, if the edit it is cancelled, the function</p>
<p>checkCancel2 will be called, it can be util for example if you want buttons that appear and disappear relative to the real possible operations and dont</p>
<p>have all buttons always displayed for possible operations not applicable at certain momment.</p>
<p>//&#160; ** MY CODE ****</p>
<p>jQuery(grid).editRow(actualRow, true, null, null, url, null, checkSave2, checkCancel2);</p>
<p>function checkCancel2(rowid){<br />&#160;&#160;&#160; var imgEditar = "&#60;img src=&#39;${editImg}&#39; width=&#39;16&#39; height=&#39;16&#39; border=&#39;0&#39; onclick=jQuery(&#39;#listC2&#39;).setSelection(&#39;"+rowid+"&#39;); /&#62;";</p>
<p>&#160;&#160;&#160; jQuery(&#39;#listC2&#39;).setRowData(rowid, data2); //nou<br />&#160;&#160;&#160; jQuery(&#39;#listC2&#39;).setRowData(rowid,{acciones:imgEditar});<br />&#160;&#160;&#160; data2="";<br />&#160;&#160;&#160; if (numEdit2 == 1) {numEdit2=numEdit2-1;}&#160;&#160;&#160; <br />}</p>
<p>// ** End My CODE *</p>
</p>
<p>/********</p>
<p>*** grid.inlinedit.js</p>
<p>********/</p>
<p>;(function($){<br />/*<br />**<br />&#160;* jqGrid extension for manipulating Grid Data<br />&#160;* Tony Tomov <a href="mailto:tony@trirand.com" target="_blank">tony@trirand.com</a><br />&#160;* <a href="http://trirand.com/blog/" rel="nofollow" target="_blank">http://trirand.com/blog/</a> <br />&#160;* Dual licensed under the MIT and GPL licenses:<br />&#160;* <a href="http://www.opensource.org/licenses/mit-license.php" rel="nofollow" target="_blank"><a href="http://www.opensource.org/lice" rel="nofollow">http://www.opensource.org/lice</a>.....icense.php</a><br />&#160;* <a href="http://www.gnu.org/licenses/gpl.html" rel="nofollow" target="_blank">http://www.gnu.org/licenses/gpl.html</a><br />**/ </p>
<p>$.fn.extend({<br />// Editing<br />&#160;&#160;&#160; editRow : function(rowid,keys,oneditfunc,succesfunc, url, extraparam, aftersavefunc, afterCancelFunc) {<br />&#160;&#160;&#160; &#160;&#160;&#160; return this.each(function(){<br />&#160;&#160;&#160; &#160;&#160;&#160; var $t = this, nm, tmp, editable, cnt=0, focus=null, svr=[];<br />&#160;&#160;&#160; &#160;&#160;&#160; if (!$t.grid ) return;<br />&#160;&#160;&#160; &#160;&#160;&#160; var sz, ml,hc;<br />&#160;&#160;&#160; &#160;&#160;&#160; if( !$t.p.multiselect ) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; editable = $(&#39;#&#39;+rowid,$t.grid.bDiv).attr("editable") &#124;&#124; "0";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (editable === "0") {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid+&#39; td&#39;,$t.grid.bDiv).each( function(i) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; nm = $t.p.colModel[i].name;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; hc = $t.p.colModel[i].hidden===true ? true : false<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if ( nm !== &#39;cb&#39; &#38;&#38; nm !== &#39;subgrid&#39; &#38;&#38; $t.p.colModel[i].editable===true &#38;&#38; !hc) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(focus===null) focus = i;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; tmp = $(this).html().replace(/\\&#38;nbsp\\;/ig,&#39;&#39;);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; svr[nm]=tmp;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this).html("");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var opt = $.extend($t.p.colModel[i].editoptions &#124;&#124; {} ,{id:rowid+"_"+nm,name:nm});<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(!$t.p.colModel[i].edittype) $t.p.colModel[i].edittype = "text";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var elc = createEl($t.p.colModel[i].edittype,opt,tmp);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(elc).addClass("editable");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this).append(elc);&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; cnt++;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(cnt &#62; 0) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; svr[&#39;id&#39;] = rowid; $t.p.savedRow.push(svr);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid,$t.grid.bDiv).attr("editable","1");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid+" td:eq("+focus+") input",$t.grid.bDiv).focus();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(keys===true) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid,$t.grid.bDiv).bind("keydown",function(e) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (e.keyCode === 27) $($t).restoreRow(rowid, afterCancelFunc);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (e.keyCode === 13) $($t).saveRow(rowid,succesfunc, url, extraparam, aftersavefunc);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e.stopPropagation();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if( typeof oneditfunc === "function") oneditfunc(rowid);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#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; function createEl(eltype,options,vl)<br />&#160;&#160;&#160; &#160;&#160;&#160; {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var elem = "";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; switch (eltype)<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case "textarea" :<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem = document.createElement("textarea");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (!options.rows) options.rows = 1;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(elem).attr(options);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem.innerHTML = vl;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case "checkbox" :<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem = document.createElement("input");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem.type = "checkbox";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(elem).attr({id:options.id,name:options.name});<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if( !options.value) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(vl==&#39;1&#39;) {<br />&#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; elem.checked=true;<br />&#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; elem.defaultChecked=true;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else {<br />&#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; elem.checked=false;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else if(vl == options.value.split(":")[0]) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem.checked=true;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem.defaultChecked=true;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case "select" :<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var so = options.value.split(";"),sv, ov;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem = document.createElement("select");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(elem).attr({id:options.id,name:options.name});<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for(var i=0; i&#60;so.length;i++){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; sv = so[i].split(":");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ov = document.createElement("option");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(ov).val(sv[0]).text(sv[1]);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (sv[1]==vl) ov.selected ="selected";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem.appendChild(ov);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case "text" :<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem = document.createElement("input");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem.type = "text";<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (!options.size) options.size = vl.length;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(elem).attr(options);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; elem.value = vl;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return elem;<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; },</p>
<p>&#160;&#160;&#160; saveRow : function(rowid, succesfunc, url, extraparam, aftersavefunc) {<br />&#160;&#160;&#160; &#160;&#160;&#160; return this.each(function(){<br />&#160;&#160;&#160; &#160;&#160;&#160; var $t = this, nm, tmp={}, tmp2, editable, fr;<br />&#160;&#160;&#160; &#160;&#160;&#160; if (!$t.grid ) return;<br />&#160;&#160;&#160; &#160;&#160;&#160; editable = $(&#39;#&#39;+rowid,$t.grid.bDiv).attr("editable");<br />&#160;&#160;&#160; &#160;&#160;&#160; url = url ? url : $t.p.editurl;<br />&#160;&#160;&#160; &#160;&#160;&#160; if (editable==="1" &#38;&#38; url) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid+" td",$t.grid.bDiv).each(function(i) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; nm = $t.p.colModel[i].name;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if ( nm !== &#39;cb&#39; &#38;&#38; nm !== &#39;subgrid&#39; &#38;&#38; $t.p.colModel[i].editable===true) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if( $t.p.colModel[i].hidden===true) tmp[nm] = $(this).html();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; else if( $t.p.colModel[i].edittype===&#39;checkbox&#39;) tmp[nm]=&#160; $("input",this).attr("checked") ? 1 : 0;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; else tmp[nm]= $("input, select&#62;option:selected, textarea",this).val();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(tmp) { tmp["id"] = rowid; if(extraparam) $.extend(tmp,extraparam);}<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(!$t.grid.hDiv.loading) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $t.grid.hDiv.loading = true;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $("div.loading",$t.grid.hDiv).fadeIn("fast");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $.post(url,tmp,function(res,stat){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (stat === "success"){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var ret;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if( typeof succesfunc === "function") ret = succesfunc(res);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; else ret = true;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (ret===true) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid+" td",$t.grid.bDiv).each(function(i) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; nm = $t.p.colModel[i].name;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if ( nm !== &#39;cb&#39; &#38;&#38; nm !== &#39;subgrid&#39; &#38;&#38; $t.p.colModel[i].editable===true) {<br />&#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; switch ($t.p.colModel[i].edittype) {<br />&#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; case "select":<br />&#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; tmp2 = $("select&#62;option:selected", this).text();<br />&#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; break;<br />&#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; case "checkbox":<br />&#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; var cbv = $t.p.colModel[i].editoptions.value.split(":") &#124;&#124; ["Yes","No"];<br />&#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; tmp2 = $("input",this).attr("checked") ? cbv[0] : cbv[1];<br />&#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; break;<br />&#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; case "text":<br />&#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; case "textarea":<br />&#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; tmp2 = $("input, textarea", this).val();<br />&#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; break;<br />&#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; }<br />&#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; $(this).empty();<br />&#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; $(this).html(tmp2 &#124;&#124; "&#38;nbsp;");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid,$t.grid.bDiv).attr("editable","0");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for( var k=0;k&#60;$t.p.savedRow.length;k++) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if( $t.p.savedRow[k].id===rowid) {fr = k; break;}<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; };<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(fr &#62;= 0) $t.p.savedRow.splice(fr,1);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if( typeof aftersavefunc === "function") aftersavefunc(rowid,res);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else $($t).restoreRow(rowid);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } else {alert("Error Row: "+rowid+" Result: " +res+" Status: "+stat)}&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $t.grid.hDiv.loading = false;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $("div.loading",$t.grid.hDiv).fadeOut("fast");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $("#"+rowid,$t.grid.bDiv).unbind("keydown");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; },</p>
<p>&#160;&#160;&#160; restoreRow : function(rowid, afterCancelFunc) {<br />&#160;&#160;&#160; &#160;&#160;&#160; return this.each(function(){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var $t= this, nm, fr;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (!$t.grid ) return;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for( var k=0;k&#60;$t.p.savedRow.length;k++) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if( $t.p.savedRow[k].id===rowid) {fr = k; break;}<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; };<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(fr &#62;= 0) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid+" td",$t.grid.bDiv).each(function(i) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; nm = $t.p.colModel[i].name;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if ( nm !== &#39;cb&#39; &#38;&#38; nm !== &#39;subgrid&#39; &#38;&#38; $t.p.colModel[i].editable==true) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this).empty()<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this).html($t.p.savedRow[fr][nm] &#124;&#124; "&#38;nbsp;");<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#&#39;+rowid,$t.grid.bDiv).attr("editable","0");&#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $t.p.savedRow.splice(fr,1);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if( typeof afterCancelFunc === "function") afterCancelFunc(rowid);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; },<br />/// end editing<br />&#160;&#160;&#160; sortGrid : function(colname,reload){<br />&#160;&#160;&#160; &#160;&#160;&#160; return this.each(function(){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var $t=this,idx=-1;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (!$t.grid ) return;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(!colname) colname = $t.p.sortname;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for(var i=0;i&#60;$t.p.colModel.length;i++) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if($t.p.colModel[i].index == colname &#124;&#124; $t.p.colModel[i].name==colname) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; idx = i;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(idx!=-1){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var sort = $t.p.colModel[idx].sortable;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if( typeof sort !== &#39;boolean&#39;) sort =&#160; true;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if( typeof reload !==&#39;boolean&#39;) reload = false;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(sort) $t.sortData(colname, idx, reload);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; };<br />&#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; },<br />&#160;&#160;&#160; <br />&#160;&#160;&#160; GridDestroy : function () {<br />&#160;&#160;&#160; &#160;&#160;&#160; return this.each(function(){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (this.p.pager) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this.p.pager).unbind();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this.p.pager).remove();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this).unbind();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this.grid.bDiv).remove();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this.grid.hDiv).remove();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; this.p = null;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; this.grid =null;<br />&#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; },</p>
<p>&#160;&#160;&#160; GridUnload : function(){<br />&#160;&#160;&#160; &#160;&#160;&#160; return this.each(function(){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var defgrid = {id: $(this).attr(&#39;id&#39;),cl: $(this).attr(&#39;class&#39;),cellSpacing: $(this).attr(&#39;cellspacing&#39;) &#124;&#124; &#39;0&#39;,cellPadding:$(this).attr(&#39;cellpadding&#39;) &#124;&#124; &#39;0&#39;};<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (this.p.pager) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this.p.pager).unbind();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this.p.pager).empty();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this).unbind();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var newtable = document.createElement(&#39;table&#39;);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(newtable).attr({id:defgrid[&#39;id&#39;],cellSpacing:defgrid[&#39;cellSpacing&#39;], cellPadding:defgrid[&#39;cellPadding&#39;]});<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; newtable.className = defgrid[&#39;cl&#39;];<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this.grid.bDiv).remove();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(this.grid.hDiv).before(newtable).remove();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; this.p = null;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; this.grid =null;<br />&#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; }<br />});<br />})(jQuery);</p>
]]></description>
        	        	<pubDate>Tue, 01 Jul 2008 05:35:24 +0300</pubDate>
        </item>
        <item>
        	<title>josepk on Intercepting ESC key in inline Mode : Done</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/intercepting-esc-key-in-inline-mode-done#p944</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/intercepting-esc-key-in-inline-mode-done#p944</guid>
        	        	<description><![CDATA[<p>Hi ,</p>
<p>I have found the solution, if somebody wants the full file modified: grdi.inlineedit.js, I will post it to some url.</p>
<p>I have modified the grid.inlinedit.js and&#160; added a function :</p>
<p>afterCancelFunc to the editRow.</p>
<p>And when you press ESC key the function is called.</p>
<p>I posted the code :</p>
<p><span style="font-size: x-small;"><span style="font-size: x-small;"></span></span></p>
<p>editRow :</p>
<p><span style="font-size: x-small;"><font size="2"></p>
<p></font></span><br /><span style="font-size: xx-small;"><span style="font-size: x-small; color: #7f0055;">function</span><span style="font-size: x-small;">(rowid,keys,oneditfunc,succesfunc, url, extraparam, aftersavefunc, afterCancelFunc) </span></span></p>
</p>
<p><span style="font-size: x-small; color: #7f0055;"><span style="font-size: xx-small;">{<span style="font-size: x-small; color: #7f0055;">if </span><span style="font-size: x-small;"><span style="color: #000000;">(e.keyCode === 13) $($t).saveRow(rowid,succesfunc, url, extraparam, aftersavefunc);</span></span></span></span></p>
</p>
<p><span style="font-size: x-small; color: #7f0055;"><span style="font-size: x-small;"><span style="font-size: x-small;"></span></span></span><span style="font-size: x-small; color: #7f0055;"><span style="font-size: x-small;"><span style="font-size: x-small; color: #7f0055;"><span style="font-size: xx-small;"><span style="font-size: x-small; color: #7f0055;">if</span><span style="font-size: x-small;"><span style="color: #000000;">( </span></span><span style="font-size: x-small; color: #7f0055;">typeof </span><span style="font-size: x-small;"><span style="color: #000000;">afterCancelFunc === </span></span><span style="font-size: x-small; color: #8e00ff;">&#8220;function&#8221;</span></span><span style="font-size: x-small;"><span style="font-size: xx-small; color: #000000;">) afterCancelFunc(rowid);<br /></span></span></span></span></span></p>
<p>restoreRow :</p>
<p><span style="font-size: x-small;"><br /></span></p>
<p><span style="font-size: xx-small;"><span style="font-size: x-small; color: #7f0055;">function</span><span style="font-size: x-small;">(rowid, afterCancelFunc) {</span></span></p>
</p>
<p>I have tested and It works.</p>
<p><span style="font-size: x-small; color: #7f0055;"><span style="font-size: x-small;"><span style="font-size: x-small; color: #7f0055;"><span style="font-size: x-small;"></span></span></span></span></p>
<p>Josep Escofet</p>
<p><span style="font-size: x-small;"><font size="2" color="#7f0055"></font><font size="2"></font><font size="2" color="#7f0055"></font><font size="2"></p>
<p></font></span><span style="font-size: x-small;"><font size="2" color="#7f0055"></font><font size="2"></font><font size="2" color="#7f0055"></p>
<p></font></span><span style="font-size: x-small;"><font size="2" color="#7f0055"></font><font size="2"></p>
<p></font></span><span style="font-size: x-small;"><font size="2" color="#7f0055"></p>
<p></font></span></p></p>
]]></description>
        	        	<pubDate>Mon, 30 Jun 2008 07:10:13 +0300</pubDate>
        </item>
</channel>
</rss>