rails_jq_grid 0.0.3.pre2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/VERSION +1 -1
  2. data/public/javascripts/rails-jqgrid/Changes.txt +0 -0
  3. data/public/javascripts/rails-jqgrid/i18n/grid.locale-bg.js +132 -1
  4. data/public/javascripts/rails-jqgrid/i18n/grid.locale-bg1251.js +132 -1
  5. data/public/javascripts/rails-jqgrid/i18n/grid.locale-cat.js +128 -1
  6. data/public/javascripts/rails-jqgrid/i18n/grid.locale-cn.js +132 -1
  7. data/public/javascripts/rails-jqgrid/i18n/grid.locale-cs.js +128 -1
  8. data/public/javascripts/rails-jqgrid/i18n/grid.locale-da.js +128 -0
  9. data/public/javascripts/rails-jqgrid/i18n/grid.locale-de.js +133 -1
  10. data/public/javascripts/rails-jqgrid/i18n/grid.locale-el.js +126 -1
  11. data/public/javascripts/rails-jqgrid/i18n/grid.locale-en.js +128 -1
  12. data/public/javascripts/rails-jqgrid/i18n/grid.locale-es.js +128 -1
  13. data/public/javascripts/rails-jqgrid/i18n/grid.locale-fa.js +145 -1
  14. data/public/javascripts/rails-jqgrid/i18n/grid.locale-fi.js +130 -1
  15. data/public/javascripts/rails-jqgrid/i18n/grid.locale-fr.js +126 -1
  16. data/public/javascripts/rails-jqgrid/i18n/grid.locale-gl.js +126 -0
  17. data/public/javascripts/rails-jqgrid/i18n/grid.locale-he.js +127 -1
  18. data/public/javascripts/rails-jqgrid/i18n/grid.locale-hu.js +129 -1
  19. data/public/javascripts/rails-jqgrid/i18n/grid.locale-is.js +126 -1
  20. data/public/javascripts/rails-jqgrid/i18n/grid.locale-it.js +1 -1
  21. data/public/javascripts/rails-jqgrid/i18n/grid.locale-ja.js +155 -1
  22. data/public/javascripts/rails-jqgrid/i18n/grid.locale-nl.js +149 -1
  23. data/public/javascripts/rails-jqgrid/i18n/grid.locale-no.js +1 -1
  24. data/public/javascripts/rails-jqgrid/i18n/grid.locale-pl.js +127 -1
  25. data/public/javascripts/rails-jqgrid/i18n/grid.locale-pt-br.js +127 -1
  26. data/public/javascripts/rails-jqgrid/i18n/grid.locale-pt.js +125 -1
  27. data/public/javascripts/rails-jqgrid/i18n/grid.locale-ro.js +139 -1
  28. data/public/javascripts/rails-jqgrid/i18n/grid.locale-ru.js +127 -1
  29. data/public/javascripts/rails-jqgrid/i18n/grid.locale-sk.js +127 -1
  30. data/public/javascripts/rails-jqgrid/i18n/grid.locale-sr.js +128 -0
  31. data/public/javascripts/rails-jqgrid/i18n/grid.locale-sv.js +127 -1
  32. data/public/javascripts/rails-jqgrid/i18n/grid.locale-tr.js +126 -1
  33. data/public/javascripts/rails-jqgrid/i18n/grid.locale-ua.js +127 -1
  34. data/public/javascripts/rails-jqgrid/install.txt +0 -0
  35. data/public/javascripts/rails-jqgrid/jquery.jqGrid.min.js +445 -432
  36. data/public/javascripts/rails-jqgrid/src/JsonXml.js +329 -329
  37. data/public/javascripts/rails-jqgrid/src/css/ellipsis-xbl.xml +0 -0
  38. data/public/javascripts/rails-jqgrid/src/css/ui.jqgrid.css +139 -129
  39. data/public/javascripts/rails-jqgrid/src/css/ui.multiselect.css +0 -0
  40. data/public/javascripts/rails-jqgrid/src/grid.base.js +3078 -3003
  41. data/public/javascripts/rails-jqgrid/src/grid.celledit.js +486 -486
  42. data/public/javascripts/rails-jqgrid/src/grid.common.js +646 -636
  43. data/public/javascripts/rails-jqgrid/src/grid.custom.js +820 -817
  44. data/public/javascripts/rails-jqgrid/src/grid.formedit.js +1954 -1872
  45. data/public/javascripts/rails-jqgrid/src/grid.grouping.js +250 -0
  46. data/public/javascripts/rails-jqgrid/src/grid.import.js +200 -200
  47. data/public/javascripts/rails-jqgrid/src/grid.inlinedit.js +255 -250
  48. data/public/javascripts/rails-jqgrid/src/grid.jqueryui.js +504 -503
  49. data/public/javascripts/rails-jqgrid/src/grid.loader.js +1 -0
  50. data/public/javascripts/rails-jqgrid/src/grid.postext.js +63 -63
  51. data/public/javascripts/rails-jqgrid/src/grid.setcolumns.js +125 -125
  52. data/public/javascripts/rails-jqgrid/src/grid.subgrid.js +260 -260
  53. data/public/javascripts/rails-jqgrid/src/grid.tbltogrid.js +106 -106
  54. data/public/javascripts/rails-jqgrid/src/grid.treegrid.js +489 -482
  55. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-bg.js +132 -132
  56. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-bg1251.js +132 -132
  57. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-cat.js +128 -128
  58. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-cn.js +132 -132
  59. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-cs.js +128 -128
  60. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-da.js +128 -0
  61. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-de.js +132 -127
  62. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-dk.js +0 -0
  63. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-el.js +126 -126
  64. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-en.js +128 -128
  65. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-es.js +128 -128
  66. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-fa.js +145 -125
  67. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-fi.js +130 -130
  68. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-fr.js +2 -2
  69. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-gl.js +126 -0
  70. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-he.js +127 -127
  71. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-hu.js +129 -129
  72. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-is.js +126 -126
  73. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-it.js +0 -0
  74. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ja.js +155 -155
  75. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-nl.js +148 -148
  76. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-no.js +0 -0
  77. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-pl.js +126 -126
  78. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-pt-br.js +127 -127
  79. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-pt.js +125 -125
  80. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ro.js +139 -139
  81. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ru.js +127 -127
  82. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-sk.js +127 -127
  83. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-sr.js +128 -0
  84. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-sv.js +127 -127
  85. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-tr.js +126 -126
  86. data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ua.js +127 -127
  87. data/public/javascripts/rails-jqgrid/src/jqDnR.js +68 -67
  88. data/public/javascripts/rails-jqgrid/src/jqModal.js +68 -68
  89. data/public/javascripts/rails-jqgrid/src/jquery.fmatter.js +563 -541
  90. data/public/javascripts/rails-jqgrid/src/jquery.searchFilter.js +1 -1
  91. data/public/javascripts/rails-jqgrid/src/ui.multiselect.js +0 -0
  92. data/public/stylesheets/rails-jqgrid/ellipsis-xbl.xml +0 -0
  93. data/public/stylesheets/rails-jqgrid/ui.jqgrid.css +139 -2
  94. data/rails_jq_grid.gemspec +10 -3
  95. metadata +15 -11
@@ -1,250 +1,255 @@
1
- ;(function($){
2
- /**
3
- * jqGrid extension for manipulating Grid Data
4
- * Tony Tomov tony@trirand.com
5
- * http://trirand.com/blog/
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl-2.0.html
9
- **/
10
- $.jgrid.extend({
11
- //Editing
12
- editRow : function(rowid,keys,oneditfunc,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
13
- return this.each(function(){
14
- var $t = this, nm, tmp, editable, cnt=0, focus=null, svr={}, ind,cm;
15
- if (!$t.grid ) { return; }
16
- ind = $($t).jqGrid("getInd",rowid,true);
17
- if( ind === false ) {return;}
18
- editable = $(ind).attr("editable") || "0";
19
- if (editable == "0" && !$(ind).hasClass("not-editable-row")) {
20
- cm = $t.p.colModel;
21
- $('td',ind).each( function(i) {
22
- nm = cm[i].name;
23
- var treeg = $t.p.treeGrid===true && nm == $t.p.ExpandColumn;
24
- if(treeg) { tmp = $("span:first",this).html();}
25
- else {
26
- try {
27
- tmp = $.unformat(this,{rowId:rowid, colModel:cm[i]},i);
28
- } catch (_) {
29
- tmp = $(this).html();
30
- }
31
- }
32
- if ( nm != 'cb' && nm != 'subgrid' && nm != 'rn') {
33
- if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
34
- svr[nm]=tmp;
35
- if(cm[i].editable===true) {
36
- if(focus===null) { focus = i; }
37
- if (treeg) { $("span:first",this).html(""); }
38
- else { $(this).html(""); }
39
- var opt = $.extend({},cm[i].editoptions || {},{id:rowid+"_"+nm,name:nm});
40
- if(!cm[i].edittype) { cm[i].edittype = "text"; }
41
- var elc = createEl(cm[i].edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {}));
42
- $(elc).addClass("editable");
43
- if(treeg) { $("span:first",this).append(elc); }
44
- else { $(this).append(elc); }
45
- //Again IE
46
- if(cm[i].edittype == "select" && cm[i].editoptions.multiple===true && $.browser.msie) {
47
- $(elc).width($(elc).width());
48
- }
49
- cnt++;
50
- }
51
- }
52
- });
53
- if(cnt > 0) {
54
- svr.id = rowid; $t.p.savedRow.push(svr);
55
- $(ind).attr("editable","1");
56
- $("td:eq("+focus+") input",ind).focus();
57
- if(keys===true) {
58
- $(ind).bind("keydown",function(e) {
59
- if (e.keyCode === 27) {$($t).jqGrid("restoreRow",rowid, afterrestorefunc);}
60
- if (e.keyCode === 13) {
61
- var ta = e.target;
62
- if(ta.tagName == 'TEXTAREA') { return true; }
63
- $($t).jqGrid("saveRow",rowid,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc );
64
- return false;
65
- }
66
- e.stopPropagation();
67
- });
68
- }
69
- if( $.isFunction(oneditfunc)) { oneditfunc(rowid); }
70
- }
71
- }
72
- });
73
- },
74
- saveRow : function(rowid, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
75
- return this.each(function(){
76
- var $t = this, nm, tmp={}, tmp2={}, editable, fr, cv, ind;
77
- if (!$t.grid ) { return; }
78
- ind = $($t).jqGrid("getInd",rowid,true);
79
- if(ind === false) {return;}
80
- editable = $(ind).attr("editable");
81
- url = url ? url : $t.p.editurl;
82
- if (editable==="1") {
83
- var cm;
84
- $("td",ind).each(function(i) {
85
- cm = $t.p.colModel[i];
86
- nm = cm.name;
87
- if ( nm != 'cb' && nm != 'subgrid' && cm.editable===true && nm != 'rn') {
88
- switch (cm.edittype) {
89
- case "checkbox":
90
- var cbv = ["Yes","No"];
91
- if(cm.editoptions ) {
92
- cbv = cm.editoptions.value.split(":");
93
- }
94
- tmp[nm]= $("input",this).attr("checked") ? cbv[0] : cbv[1];
95
- break;
96
- case 'text':
97
- case 'password':
98
- case 'textarea':
99
- case "button" :
100
- tmp[nm]=$("input, textarea",this).val();
101
- break;
102
- case 'select':
103
- if(!cm.editoptions.multiple) {
104
- tmp[nm] = $("select>option:selected",this).val();
105
- tmp2[nm] = $("select>option:selected", this).text();
106
- } else {
107
- var sel = $("select",this), selectedText = [];
108
- tmp[nm] = $(sel).val();
109
- if(tmp[nm]) { tmp[nm]= tmp[nm].join(","); } else { tmp[nm] =""; }
110
- $("select > option:selected",this).each(
111
- function(i,selected){
112
- selectedText[i] = $(selected).text();
113
- }
114
- );
115
- tmp2[nm] = selectedText.join(",");
116
- }
117
- if(cm.formatter && cm.formatter == 'select') { tmp2={}; }
118
- break;
119
- case 'custom' :
120
- try {
121
- if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) {
122
- tmp[nm] = cm.editoptions.custom_value($(".customelement",this),'get');
123
- if (tmp[nm] === undefined) { throw "e2"; }
124
- } else { throw "e1"; }
125
- } catch (e) {
126
- if (e=="e1") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
127
- if (e=="e2") { info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
128
- else { info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
129
- }
130
- break;
131
- }
132
- cv = checkValues(tmp[nm],i,$t);
133
- if(cv[0] === false) {
134
- cv[1] = tmp[nm] + " " + cv[1];
135
- return false;
136
- }
137
- if($t.p.autoencode) { tmp[nm] = $.jgrid.htmlEncode(tmp[nm]); }
138
- }
139
- });
140
- if (cv[0] === false){
141
- try {
142
- var positions = findPos($("#"+$.jgrid.jqID(rowid), $t.grid.bDiv)[0]);
143
- info_dialog($.jgrid.errors.errcap,cv[1],$.jgrid.edit.bClose,{left:positions[0],top:positions[1]});
144
- } catch (e) {
145
- alert(cv[1]);
146
- }
147
- return;
148
- }
149
- if(tmp) {
150
- var idname, opers, oper;
151
- opers = $t.p.prmNames;
152
- oper = opers.oper;
153
- idname = opers.id;
154
- tmp[oper] = opers.editoper;
155
- tmp[idname] = rowid;
156
- if(typeof($t.p.inlineData) == 'undefined') { $t.p.inlineData ={}; }
157
- if(typeof(extraparam) == 'undefined') { extraparam ={}; }
158
- tmp = $.extend({},tmp,$t.p.inlineData,extraparam);
159
- }
160
- if (url == 'clientArray') {
161
- tmp = $.extend({},tmp, tmp2);
162
- if($t.p.autoencode) {
163
- $.each(tmp,function(n,v){
164
- tmp[n] = $.jgrid.htmlDecode(v);
165
- });
166
- }
167
- var resp = $($t).jqGrid("setRowData",rowid,tmp);
168
- $(ind).attr("editable","0");
169
- for( var k=0;k<$t.p.savedRow.length;k++) {
170
- if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
171
- }
172
- if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
173
- if( $.isFunction(aftersavefunc) ) { aftersavefunc(rowid,resp); }
174
- } else {
175
- $("#lui_"+$t.p.id).show();
176
- $.ajax($.extend({
177
- url:url,
178
- data: $.isFunction($t.p.serializeRowData) ? $t.p.serializeRowData(tmp) : tmp,
179
- type: "POST",
180
- complete: function(res,stat){
181
- $("#lui_"+$t.p.id).hide();
182
- if (stat === "success"){
183
- var ret;
184
- if( $.isFunction(succesfunc)) { ret = succesfunc(res);}
185
- else { ret = true; }
186
- if (ret===true) {
187
- if($t.p.autoencode) {
188
- $.each(tmp,function(n,v){
189
- tmp[n] = $.jgrid.htmlDecode(v);
190
- });
191
- }
192
- tmp = $.extend({},tmp, tmp2);
193
- $($t).jqGrid("setRowData",rowid,tmp);
194
- $(ind).attr("editable","0");
195
- for( var k=0;k<$t.p.savedRow.length;k++) {
196
- if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
197
- }
198
- if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
199
- if( $.isFunction(aftersavefunc) ) { aftersavefunc(rowid,res); }
200
- } else { $($t).jqGrid("restoreRow",rowid, afterrestorefunc); }
201
- }
202
- },
203
- error:function(res,stat){
204
- $("#lui_"+$t.p.id).hide();
205
- if($.isFunction(errorfunc) ) {
206
- errorfunc(rowid, res, stat);
207
- } else {
208
- alert("Error Row: "+rowid+" Result: " +res.status+":"+res.statusText+" Status: "+stat);
209
- }
210
- $($t).jqGrid("restoreRow",rowid, afterrestorefunc);
211
- }
212
- }, $.jgrid.ajaxOptions, $t.p.ajaxRowOptions || {}));
213
- }
214
- $(ind).unbind("keydown");
215
- }
216
- });
217
- },
218
- restoreRow : function(rowid, afterrestorefunc) {
219
- return this.each(function(){
220
- var $t= this, fr, ind, ares={};
221
- if (!$t.grid ) { return; }
222
- ind = $($t).jqGrid("getInd",rowid,true);
223
- if(ind === false) {return;}
224
- for( var k=0;k<$t.p.savedRow.length;k++) {
225
- if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
226
- }
227
- if(fr >= 0) {
228
- if($.isFunction($.fn.datepicker)) {
229
- try {
230
- $("input.hasDatepicker","#"+$.jgrid.jqID(ind.id)).datepicker('hide');
231
- } catch (e) {}
232
- }
233
- $.each($t.p.colModel, function(i,n){
234
- if(this.editable === true && this.name in $t.p.savedRow[fr]) {
235
- ares[this.name] = $t.p.savedRow[fr][this.name];
236
- }
237
- });
238
- $($t).jqGrid("setRowData",rowid,ares);
239
- $(ind).attr("editable","0").unbind("keydown");
240
- $t.p.savedRow.splice(fr,1);
241
- }
242
- if ($.isFunction(afterrestorefunc))
243
- {
244
- afterrestorefunc(rowid);
245
- }
246
- });
247
- }
248
- //end inline edit
249
- });
250
- })(jQuery);
1
+ ;(function($){
2
+ /**
3
+ * jqGrid extension for manipulating Grid Data
4
+ * Tony Tomov tony@trirand.com
5
+ * http://trirand.com/blog/
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl-2.0.html
9
+ **/
10
+ $.jgrid.extend({
11
+ //Editing
12
+ editRow : function(rowid,keys,oneditfunc,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
13
+ return this.each(function(){
14
+ var $t = this, nm, tmp, editable, cnt=0, focus=null, svr={}, ind,cm;
15
+ if (!$t.grid ) { return; }
16
+ ind = $($t).jqGrid("getInd",rowid,true);
17
+ if( ind === false ) {return;}
18
+ editable = $(ind).attr("editable") || "0";
19
+ if (editable == "0" && !$(ind).hasClass("not-editable-row")) {
20
+ cm = $t.p.colModel;
21
+ $('td',ind).each( function(i) {
22
+ nm = cm[i].name;
23
+ var treeg = $t.p.treeGrid===true && nm == $t.p.ExpandColumn;
24
+ if(treeg) { tmp = $("span:first",this).html();}
25
+ else {
26
+ try {
27
+ tmp = $.unformat(this,{rowId:rowid, colModel:cm[i]},i);
28
+ } catch (_) {
29
+ tmp = $(this).html();
30
+ }
31
+ }
32
+ if ( nm != 'cb' && nm != 'subgrid' && nm != 'rn') {
33
+ if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
34
+ svr[nm]=tmp;
35
+ if(cm[i].editable===true) {
36
+ if(focus===null) { focus = i; }
37
+ if (treeg) { $("span:first",this).html(""); }
38
+ else { $(this).html(""); }
39
+ var opt = $.extend({},cm[i].editoptions || {},{id:rowid+"_"+nm,name:nm});
40
+ if(!cm[i].edittype) { cm[i].edittype = "text"; }
41
+ var elc = $.jgrid.createEl(cm[i].edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {}));
42
+ $(elc).addClass("editable");
43
+ if(treeg) { $("span:first",this).append(elc); }
44
+ else { $(this).append(elc); }
45
+ //Again IE
46
+ if(cm[i].edittype == "select" && cm[i].editoptions.multiple===true && $.browser.msie) {
47
+ $(elc).width($(elc).width());
48
+ }
49
+ cnt++;
50
+ }
51
+ }
52
+ });
53
+ if(cnt > 0) {
54
+ svr.id = rowid; $t.p.savedRow.push(svr);
55
+ $(ind).attr("editable","1");
56
+ $("td:eq("+focus+") input",ind).focus();
57
+ if(keys===true) {
58
+ $(ind).bind("keydown",function(e) {
59
+ if (e.keyCode === 27) {$($t).jqGrid("restoreRow",rowid, afterrestorefunc);}
60
+ if (e.keyCode === 13) {
61
+ var ta = e.target;
62
+ if(ta.tagName == 'TEXTAREA') { return true; }
63
+ $($t).jqGrid("saveRow",rowid,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc );
64
+ return false;
65
+ }
66
+ e.stopPropagation();
67
+ });
68
+ }
69
+ if( $.isFunction(oneditfunc)) { oneditfunc.call($t, rowid); }
70
+ }
71
+ }
72
+ });
73
+ },
74
+ saveRow : function(rowid, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
75
+ return this.each(function(){
76
+ var $t = this, nm, tmp={}, tmp2={}, editable, fr, cv, ind;
77
+ if (!$t.grid ) { return; }
78
+ ind = $($t).jqGrid("getInd",rowid,true);
79
+ if(ind === false) {return;}
80
+ editable = $(ind).attr("editable");
81
+ url = url ? url : $t.p.editurl;
82
+ if (editable==="1") {
83
+ var cm;
84
+ $("td",ind).each(function(i) {
85
+ cm = $t.p.colModel[i];
86
+ nm = cm.name;
87
+ if ( nm != 'cb' && nm != 'subgrid' && cm.editable===true && nm != 'rn') {
88
+ switch (cm.edittype) {
89
+ case "checkbox":
90
+ var cbv = ["Yes","No"];
91
+ if(cm.editoptions ) {
92
+ cbv = cm.editoptions.value.split(":");
93
+ }
94
+ tmp[nm]= $("input",this).attr("checked") ? cbv[0] : cbv[1];
95
+ break;
96
+ case 'text':
97
+ case 'password':
98
+ case 'textarea':
99
+ case "button" :
100
+ tmp[nm]=$("input, textarea",this).val();
101
+ break;
102
+ case 'select':
103
+ if(!cm.editoptions.multiple) {
104
+ tmp[nm] = $("select>option:selected",this).val();
105
+ tmp2[nm] = $("select>option:selected", this).text();
106
+ } else {
107
+ var sel = $("select",this), selectedText = [];
108
+ tmp[nm] = $(sel).val();
109
+ if(tmp[nm]) { tmp[nm]= tmp[nm].join(","); } else { tmp[nm] =""; }
110
+ $("select > option:selected",this).each(
111
+ function(i,selected){
112
+ selectedText[i] = $(selected).text();
113
+ }
114
+ );
115
+ tmp2[nm] = selectedText.join(",");
116
+ }
117
+ if(cm.formatter && cm.formatter == 'select') { tmp2={}; }
118
+ break;
119
+ case 'custom' :
120
+ try {
121
+ if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) {
122
+ tmp[nm] = cm.editoptions.custom_value.call($t, $(".customelement",this),'get');
123
+ if (tmp[nm] === undefined) { throw "e2"; }
124
+ } else { throw "e1"; }
125
+ } catch (e) {
126
+ if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
127
+ if (e=="e2") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
128
+ else { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
129
+ }
130
+ break;
131
+ }
132
+ cv = $.jgrid.checkValues(tmp[nm],i,$t);
133
+ if(cv[0] === false) {
134
+ cv[1] = tmp[nm] + " " + cv[1];
135
+ return false;
136
+ }
137
+ if($t.p.autoencode) { tmp[nm] = $.jgrid.htmlEncode(tmp[nm]); }
138
+ }
139
+ });
140
+ if (cv[0] === false){
141
+ try {
142
+ var positions = $.jgrid.findPos($("#"+$.jgrid.jqID(rowid), $t.grid.bDiv)[0]);
143
+ $.jgrid.info_dialog($.jgrid.errors.errcap,cv[1],$.jgrid.edit.bClose,{left:positions[0],top:positions[1]});
144
+ } catch (e) {
145
+ alert(cv[1]);
146
+ }
147
+ return;
148
+ }
149
+ if(tmp) {
150
+ var idname, opers, oper;
151
+ opers = $t.p.prmNames;
152
+ oper = opers.oper;
153
+ idname = opers.id;
154
+ tmp[oper] = opers.editoper;
155
+ tmp[idname] = rowid;
156
+ if(typeof($t.p.inlineData) == 'undefined') { $t.p.inlineData ={}; }
157
+ if(typeof(extraparam) == 'undefined') { extraparam ={}; }
158
+ tmp = $.extend({},tmp,$t.p.inlineData,extraparam);
159
+ }
160
+ if (url == 'clientArray') {
161
+ tmp = $.extend({},tmp, tmp2);
162
+ if($t.p.autoencode) {
163
+ $.each(tmp,function(n,v){
164
+ tmp[n] = $.jgrid.htmlDecode(v);
165
+ });
166
+ }
167
+ var resp = $($t).jqGrid("setRowData",rowid,tmp);
168
+ $(ind).attr("editable","0");
169
+ for( var k=0;k<$t.p.savedRow.length;k++) {
170
+ if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
171
+ }
172
+ if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
173
+ if( $.isFunction(aftersavefunc) ) { aftersavefunc.call($t, rowid,resp); }
174
+ } else {
175
+ $("#lui_"+$t.p.id).show();
176
+ $.ajax($.extend({
177
+ url:url,
178
+ data: $.isFunction($t.p.serializeRowData) ? $t.p.serializeRowData.call($t, tmp) : tmp,
179
+ type: "POST",
180
+ complete: function(res,stat){
181
+ $("#lui_"+$t.p.id).hide();
182
+ if (stat === "success"){
183
+ var ret;
184
+ if( $.isFunction(succesfunc)) { ret = succesfunc.call($t, res);}
185
+ else { ret = true; }
186
+ if (ret===true) {
187
+ if($t.p.autoencode) {
188
+ $.each(tmp,function(n,v){
189
+ tmp[n] = $.jgrid.htmlDecode(v);
190
+ });
191
+ }
192
+ tmp = $.extend({},tmp, tmp2);
193
+ $($t).jqGrid("setRowData",rowid,tmp);
194
+ $(ind).attr("editable","0");
195
+ for( var k=0;k<$t.p.savedRow.length;k++) {
196
+ if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
197
+ }
198
+ if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
199
+ if( $.isFunction(aftersavefunc) ) { aftersavefunc.call($t, rowid,res); }
200
+ } else {
201
+ if($.isFunction(errorfunc) ) {
202
+ errorfunc.call($t, rowid, res, stat);
203
+ }
204
+ $($t).jqGrid("restoreRow",rowid, afterrestorefunc);
205
+ }
206
+ }
207
+ },
208
+ error:function(res,stat){
209
+ $("#lui_"+$t.p.id).hide();
210
+ if($.isFunction(errorfunc) ) {
211
+ errorfunc.call($t, rowid, res, stat);
212
+ } else {
213
+ alert("Error Row: "+rowid+" Result: " +res.status+":"+res.statusText+" Status: "+stat);
214
+ }
215
+ $($t).jqGrid("restoreRow",rowid, afterrestorefunc);
216
+ }
217
+ }, $.jgrid.ajaxOptions, $t.p.ajaxRowOptions || {}));
218
+ }
219
+ $(ind).unbind("keydown");
220
+ }
221
+ });
222
+ },
223
+ restoreRow : function(rowid, afterrestorefunc) {
224
+ return this.each(function(){
225
+ var $t= this, fr, ind, ares={};
226
+ if (!$t.grid ) { return; }
227
+ ind = $($t).jqGrid("getInd",rowid,true);
228
+ if(ind === false) {return;}
229
+ for( var k=0;k<$t.p.savedRow.length;k++) {
230
+ if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
231
+ }
232
+ if(fr >= 0) {
233
+ if($.isFunction($.fn.datepicker)) {
234
+ try {
235
+ $("input.hasDatepicker","#"+$.jgrid.jqID(ind.id)).datepicker('hide');
236
+ } catch (e) {}
237
+ }
238
+ $.each($t.p.colModel, function(i,n){
239
+ if(this.editable === true && this.name in $t.p.savedRow[fr]) {
240
+ ares[this.name] = $t.p.savedRow[fr][this.name];
241
+ }
242
+ });
243
+ $($t).jqGrid("setRowData",rowid,ares);
244
+ $(ind).attr("editable","0").unbind("keydown");
245
+ $t.p.savedRow.splice(fr,1);
246
+ }
247
+ if ($.isFunction(afterrestorefunc))
248
+ {
249
+ afterrestorefunc.call($t, rowid);
250
+ }
251
+ });
252
+ }
253
+ //end inline edit
254
+ });
255
+ })(jQuery);