jqgrid-jquery-rails 4.3.0.0 → 4.3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 234311f6984001fd4acd48594e280e575010e6bc
4
- data.tar.gz: 2007f386be9d81833c21f54cf3dfd6586a8ce92a
3
+ metadata.gz: b0c169df2d2100fe10705c56937f9c1a2c9464fa
4
+ data.tar.gz: 1cce7ed8a7677d350d205c6941892b8d1a1dcdb7
5
5
  SHA512:
6
- metadata.gz: cbcb39298c8ea54b186ff26b10c1d4648a38d65f186227eb5e09525684c4423581c2483517f0d0139e32385ae6641a0552558448a783d6bc869ef94b35f7e449
7
- data.tar.gz: 6fc11639e1ca4219ddd16596a84d67c5c47e70bd4b941461e2879528e63ca3c3a98113733a33f1b0df31260946c4dba934fdf52b85263c23a0eeeccc9bf481fe
6
+ metadata.gz: bc6953f8a2b78b36846077a1b72f5b9a02fbd84f7ff9482573a9b88cbee372c4c18c305379e120249513ee0abd5087f61dc6dc3e2ea991f0a3603c7780051865
7
+ data.tar.gz: b71fbcb59fbe5b595162aaeca25b81a9a117994064a970f134eeb767112639f13bb1cc3c3eb9eafeb7c2a9431bef63906b978bbd11fbeeaa239100d7e0a1a53f
data/README.md CHANGED
@@ -10,7 +10,7 @@ Add these lines to your application's `Gemfile`:
10
10
 
11
11
  ```rb
12
12
  # jqgrid jquery plugin packaged for the rails asset pipeline
13
- gem 'jqgrid-jquery-rails', '~> 4.3.0'
13
+ gem 'jqgrid-jquery-rails', '~> 4.3.1'
14
14
  ```
15
15
 
16
16
  And then execute:
@@ -7,6 +7,6 @@ module JqgridJquery
7
7
  # "2.0.0.pre"
8
8
  # "2.0.0.beta"
9
9
  # Refer to Semantic Versioning 2.0.0 (http://semver.org).
10
- VERSION = "4.3.0.0"
10
+ VERSION = "4.3.1.0"
11
11
  end
12
12
  end
@@ -2,12 +2,12 @@
2
2
  // @compilation_level SIMPLE_OPTIMIZATIONS
3
3
 
4
4
  /**
5
- * @license jqGrid 4.3.0 - jQuery Grid
5
+ * @license jqGrid 4.3.1 - jQuery Grid
6
6
  * Copyright (c) 2008, Tony Tomov, tony@trirand.com
7
7
  * Dual licensed under the MIT and GPL licenses
8
8
  * http://www.opensource.org/licenses/mit-license.php
9
9
  * http://www.gnu.org/licenses/gpl-2.0.html
10
- * Date: 2011-12-12
10
+ * Date: 2011-12-20
11
11
  */
12
12
  //jsHint options
13
13
  /*global document, window, jQuery, DOMParser, ActiveXObject, $, alert */
@@ -47,8 +47,11 @@ $.extend($.jgrid,{
47
47
  return v;
48
48
  }
49
49
  },
50
+ realType : function (arg) {
51
+ return Object.prototype.toString.call(arg).slice(8, -1);
52
+ },
50
53
  stripPref : function (pref, id) {
51
- var obj = Object.prototype.toString.call(pref).slice(8, -1);
54
+ var obj = this.realType( pref );
52
55
  if( obj == "String" || obj =="Number") {
53
56
  pref = String(pref);
54
57
  id = pref !== "" ? String(id).replace(String(pref), "") : id;
@@ -1209,7 +1212,7 @@ $.fn.jqGrid = function( pin ) {
1209
1212
  if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
1210
1213
  if(locdata) {
1211
1214
  ts.p.records = gl;
1212
- ts.p.lastpage = Math.min( ts.p.page, Math.ceil(gl/ rn) );
1215
+ ts.p.lastpage = Math.ceil(gl/ rn);
1213
1216
  }
1214
1217
  if (!more) { ts.updatepager(false,true); }
1215
1218
  if(locdata) {
@@ -1380,7 +1383,7 @@ $.fn.jqGrid = function( pin ) {
1380
1383
  if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
1381
1384
  if(locdata) {
1382
1385
  ts.p.records = len;
1383
- ts.p.lastpage = Math.min( ts.p.page, Math.ceil(len/ rn) );
1386
+ ts.p.lastpage = Math.ceil(len/ rn);
1384
1387
  }
1385
1388
  if (!more) { ts.updatepager(false,true); }
1386
1389
  if(locdata) {
@@ -2622,15 +2625,16 @@ $.jgrid.extend({
2622
2625
  if ( ia === -1 ){
2623
2626
  if(pt.className !== "ui-subgrid") { $(pt).addClass("ui-state-highlight").attr("aria-selected","true");}
2624
2627
  stat = true;
2628
+ $("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID($t.p.selrow))[$t.p.useProp ? 'prop': 'attr']("checked",stat);
2625
2629
  $t.p.selarrrow.push($t.p.selrow);
2626
2630
  } else {
2627
2631
  if(pt.className !== "ui-subgrid") { $(pt).removeClass("ui-state-highlight").attr("aria-selected","false");}
2628
2632
  stat = false;
2633
+ $("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID($t.p.selrow))[$t.p.useProp ? 'prop': 'attr']("checked",stat);
2629
2634
  $t.p.selarrrow.splice(ia,1);
2630
2635
  tpsr = $t.p.selarrrow[0];
2631
2636
  $t.p.selrow = (tpsr === undefined) ? null : tpsr;
2632
2637
  }
2633
- $("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID($t.p.selrow))[$t.p.useProp ? 'prop': 'attr']("checked",stat);
2634
2638
  if(fid) {
2635
2639
  if(ia === -1) {
2636
2640
  $("#"+$.jgrid.jqID(selection), "#"+$.jgrid.jqID(fid)).addClass("ui-state-highlight");
@@ -3135,7 +3139,12 @@ $.jgrid.extend({
3135
3139
  return this.each(function (){
3136
3140
  var $t = this;
3137
3141
  if(!$t.grid) {return;}
3138
- $($t.grid.bDiv).css({height: nh+(isNaN(nh)?"":"px")});
3142
+ var bDiv = $($t.grid.bDiv);
3143
+ bDiv.css({height: nh+(isNaN(nh)?"":"px")});
3144
+ if($t.p.frozenColumns === true){
3145
+ //follow the original set height to use 16, better scrollbar width detection
3146
+ $('#'+$t.p.id+"_frozen").parent().height(bDiv.height() - 16);
3147
+ }
3139
3148
  $t.p.height = nh;
3140
3149
  if ($t.p.scroll) { $t.grid.populateVisible(); }
3141
3150
  });
@@ -8138,301 +8147,301 @@ $.jgrid.extend({
8138
8147
  }
8139
8148
  });
8140
8149
  })(jQuery);
8141
- // Grouping module
8142
- ;(function($){
8143
- $.jgrid.extend({
8144
- groupingSetup : function () {
8145
- return this.each(function (){
8146
- var $t = this,
8147
- grp = $t.p.groupingView;
8148
- if(grp !== null && ( (typeof grp === 'object') || $.isFunction(grp) ) ) {
8149
- if(!grp.groupField.length) {
8150
- $t.p.grouping = false;
8151
- } else {
8152
- if ( typeof(grp.visibiltyOnNextGrouping) == 'undefined') {
8153
- grp.visibiltyOnNextGrouping = [];
8154
- }
8155
- for(var i=0;i<grp.groupField.length;i++) {
8156
- if(!grp.groupOrder[i]) {
8157
- grp.groupOrder[i] = 'asc';
8158
- }
8159
- if(!grp.groupText[i]) {
8160
- grp.groupText[i] = '{0}';
8161
- }
8162
- if( typeof(grp.groupColumnShow[i]) != 'boolean') {
8163
- grp.groupColumnShow[i] = true;
8164
- }
8165
- if( typeof(grp.groupSummary[i]) != 'boolean') {
8166
- grp.groupSummary[i] = false;
8167
- }
8168
- if(grp.groupColumnShow[i] === true) {
8169
- grp.visibiltyOnNextGrouping[i] = true;
8170
- $($t).jqGrid('showCol',grp.groupField[i]);
8171
- } else {
8172
- grp.visibiltyOnNextGrouping[i] = $("#"+$t.p.id+"_"+grp.groupField[i]).is(":visible");
8173
- $($t).jqGrid('hideCol',grp.groupField[i]);
8174
- }
8175
- grp.sortitems[i] = [];
8176
- grp.sortnames[i] = [];
8177
- grp.summaryval[i] = [];
8178
- if(grp.groupSummary[i]) {
8179
- grp.summary[i] =[];
8180
- var cm = $t.p.colModel;
8181
- for(var j=0, cml = cm.length; j < cml; j++) {
8182
- if(cm[j].summaryType) {
8183
- grp.summary[i].push({nm:cm[j].name,st:cm[j].summaryType, v:''});
8184
- }
8185
- }
8186
- }
8187
- }
8188
- $t.p.scroll = false;
8189
- $t.p.rownumbers = false;
8190
- $t.p.subGrid = false;
8191
- $t.p.treeGrid = false;
8192
- $t.p.gridview = true;
8193
- }
8194
- } else {
8195
- $t.p.grouping = false;
8196
- }
8197
- });
8198
- },
8199
- groupingPrepare : function (rData, items, gdata, record) {
8200
- this.each(function(){
8201
- // currently only one level
8202
- // Is this a good idea to do it so!!!!?????
8203
- items[0] += "";
8204
- var itm = items[0].toString().split(' ').join('');
8205
-
8206
- var grp = this.p.groupingView, $t= this;
8207
- if(gdata.hasOwnProperty(itm)) {
8208
- gdata[itm].push(rData);
8209
- } else {
8210
- gdata[itm] = [];
8211
- gdata[itm].push(rData);
8212
- grp.sortitems[0].push(itm);
8213
- grp.sortnames[0].push($.trim(items[0].toString()));
8214
- grp.summaryval[0][itm] = $.extend(true,[],grp.summary[0]);
8215
- }
8216
- if(grp.groupSummary[0]) {
8217
- $.each(grp.summaryval[0][itm],function() {
8218
- if ($.isFunction(this.st)) {
8219
- this.v = this.st.call($t, this.v, this.nm, record);
8220
- } else {
8221
- this.v = $($t).jqGrid('groupingCalculations.'+this.st, this.v, this.nm, record);
8222
- }
8223
- });
8224
- }
8225
- });
8226
- return gdata;
8227
- },
8228
- groupingToggle : function(hid){
8229
- this.each(function(){
8230
- var $t = this,
8231
- grp = $t.p.groupingView,
8232
- strpos = hid.lastIndexOf('_'),
8233
- uid = hid.substring(0,strpos+1),
8234
- num = parseInt(hid.substring(strpos+1),10)+1,
8235
- minus = grp.minusicon,
8236
- plus = grp.plusicon,
8237
- tar = $("#"+hid),
8238
- r = tar.length ? tar[0].nextSibling : null,
8239
- tarspan = $("#"+hid+" span."+"tree-wrap-"+$t.p.direction),
8240
- collapsed = false;
8241
- if( tarspan.hasClass(minus) ) {
8242
- if(grp.showSummaryOnHide && grp.groupSummary[0]) {
8243
- if(r){
8244
- while(r) {
8245
- if($(r).hasClass('jqfoot') ) { break; }
8246
- $(r).hide();
8247
- r = r.nextSibling;
8248
- }
8249
- }
8250
- } else {
8251
- if(r){
8252
- while(r) {
8253
- if($(r).attr('id') ==uid+String(num) ) { break; }
8254
- $(r).hide();
8255
- r = r.nextSibling;
8256
- }
8257
- }
8258
- }
8259
- tarspan.removeClass(minus).addClass(plus);
8260
- collapsed = true;
8261
- } else {
8262
- if(r){
8263
- while(r) {
8264
- if($(r).attr('id') ==uid+String(num) ) { break; }
8265
- $(r).show();
8266
- r = r.nextSibling;
8267
- }
8268
- }
8269
- tarspan.removeClass(plus).addClass(minus);
8270
- }
8271
- if( $.isFunction($t.p.onClickGroup)) { $t.p.onClickGroup.call($t, hid , collapsed); }
8272
-
8273
- });
8274
- return false;
8275
- },
8276
- groupingRender : function (grdata, colspans ) {
8277
- return this.each(function(){
8278
- var $t = this,
8279
- grp = $t.p.groupingView,
8280
- str = "", icon = "", hid, pmrtl = grp.groupCollapse ? grp.plusicon : grp.minusicon, gv, cp, ii;
8281
- //only one level for now
8282
- if(!grp.groupDataSorted) {
8283
- // ???? TO BE IMPROVED
8284
- grp.sortitems[0].sort();
8285
- grp.sortnames[0].sort();
8286
- if(grp.groupOrder[0].toLowerCase() == 'desc')
8287
- {
8288
- grp.sortitems[0].reverse();
8289
- grp.sortnames[0].reverse();
8290
- }
8291
- }
8292
- pmrtl += " tree-wrap-"+$t.p.direction;
8293
- ii = 0;
8294
- while(ii < colspans) {
8295
- if($t.p.colModel[ii].name == grp.groupField[0]) {
8296
- cp = ii;
8297
- break;
8298
- }
8299
- ii++;
8300
- }
8301
- $.each(grp.sortitems[0],function(i,n){
8302
- hid = $t.p.id+"ghead_"+i;
8303
- icon = "<span style='cursor:pointer;' class='ui-icon "+pmrtl+"' onclick=\"jQuery('#"+$t.p.id+"').jqGrid('groupingToggle','"+hid+"');return false;\"></span>";
8304
- try {
8305
- gv = $t.formatter(hid, grp.sortnames[0][i], cp, grp.sortitems[0] );
8306
- } catch (egv) {
8307
- gv = grp.sortnames[0][i];
8308
- }
8309
- str += "<tr id=\""+hid+"\" role=\"row\" class= \"ui-widget-content jqgroup ui-row-"+$t.p.direction+"\"><td colspan=\""+colspans+"\">"+icon+$.jgrid.format(grp.groupText[0], gv, grdata[n].length)+"</td></tr>";
8310
- for(var kk=0;kk<grdata[n].length;kk++) {
8311
- str += grdata[n][kk].join('');
8312
- }
8313
- if(grp.groupSummary[0]) {
8314
- var hhdr = "";
8315
- if(grp.groupCollapse && !grp.showSummaryOnHide) {
8316
- hhdr = " style=\"display:none;\"";
8317
- }
8318
- str += "<tr"+hhdr+" role=\"row\" class=\"ui-widget-content jqfoot ui-row-"+$t.p.direction+"\">";
8319
- var fdata = grp.summaryval[0][n],
8320
- cm = $t.p.colModel,
8321
- vv, grlen = grdata[n].length;
8322
- for(var k=0; k<colspans;k++) {
8323
- var tmpdata = "<td "+$t.formatCol(k,1,'')+">&#160;</td>",
8324
- tplfld = "{0}";
8325
- $.each(fdata,function(){
8326
- if(this.nm == cm[k].name) {
8327
- if(cm[k].summaryTpl) {
8328
- tplfld = cm[k].summaryTpl;
8329
- }
8330
- if(this.st == 'avg') {
8331
- if(this.v && grlen > 0) {
8332
- this.v = (this.v/grlen);
8333
- }
8334
- }
8335
- try {
8336
- vv = $t.formatter('', this.v, k, this);
8337
- } catch (ef) {
8338
- vv = this.v;
8339
- }
8340
- tmpdata= "<td "+$t.formatCol(k,1,'')+">"+$.jgrid.format(tplfld,vv)+ "</td>";
8341
- return false;
8342
- }
8343
- });
8344
- str += tmpdata;
8345
- }
8346
- str += "</tr>";
8347
- }
8348
- });
8349
- $("#"+$t.p.id+" tbody:first").append(str);
8350
- // free up memory
8351
- str = null;
8352
- });
8353
- },
8354
- groupingGroupBy : function (name, options ) {
8355
- return this.each(function(){
8356
- var $t = this;
8357
- if(typeof(name) == "string") {
8358
- name = [name];
8359
- }
8360
- var grp = $t.p.groupingView;
8361
- $t.p.grouping = true;
8362
-
8363
- //Set default, in case visibilityOnNextGrouping is undefined
8364
- if (typeof grp.visibiltyOnNextGrouping == "undefined") {
8365
- grp.visibiltyOnNextGrouping = [];
8366
- }
8367
- var i;
8368
- // show previous hidden groups if they are hidden and weren't removed yet
8369
- for(i=0;i<grp.groupField.length;i++) {
8370
- if(!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) {
8371
- $($t).jqGrid('showCol',grp.groupField[i]);
8372
- }
8373
- }
8374
- // set visibility status of current group columns on next grouping
8375
- for(i=0;i<name.length;i++) {
8376
- grp.visibiltyOnNextGrouping[i] = $("#"+$t.p.id+"_"+name[i]).is(":visible");
8377
- }
8378
- $t.p.groupingView = $.extend($t.p.groupingView, options || {});
8379
- grp.groupField = name;
8380
- $($t).trigger("reloadGrid");
8381
- });
8382
- },
8383
- groupingRemove : function (current) {
8384
- return this.each(function(){
8385
- var $t = this;
8386
- if(typeof(current) == 'undefined') {
8387
- current = true;
8388
- }
8389
- $t.p.grouping = false;
8390
- if(current===true) {
8391
- var grp = $t.p.groupingView;
8392
- // show previous hidden groups if they are hidden and weren't removed yet
8393
- for(var i=0;i<grp.groupField.length;i++) {
8394
- if (!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) {
8395
- $($t).jqGrid('showCol', grp.groupField);
8396
- }
8397
- }
8398
- $("tr.jqgroup, tr.jqfoot","#"+$t.p.id+" tbody:first").remove();
8399
- $("tr.jqgrow:hidden","#"+$t.p.id+" tbody:first").show();
8400
- } else {
8401
- $($t).trigger("reloadGrid");
8402
- }
8403
- });
8404
- },
8405
- groupingCalculations : {
8406
- "sum" : function(v, field, rc) {
8407
- return parseFloat(v||0) + parseFloat((rc[field]||0));
8408
- },
8409
- "min" : function(v, field, rc) {
8410
- if(v==="") {
8411
- return parseFloat(rc[field]||0);
8412
- }
8413
- return Math.min(parseFloat(v),parseFloat(rc[field]||0));
8414
- },
8415
- "max" : function(v, field, rc) {
8416
- if(v==="") {
8417
- return parseFloat(rc[field]||0);
8418
- }
8419
- return Math.max(parseFloat(v),parseFloat(rc[field]||0));
8420
- },
8421
- "count" : function(v, field, rc) {
8422
- if(v==="") {v=0;}
8423
- if(rc.hasOwnProperty(field)) {
8424
- return v+1;
8425
- } else {
8426
- return 0;
8427
- }
8428
- },
8429
- "avg" : function(v, field, rc) {
8430
- // the same as sum, but at end we divide it
8431
- return parseFloat(v||0) + parseFloat((rc[field]||0));
8432
- }
8433
- }
8434
- });
8435
- })(jQuery);
8150
+ // Grouping module
8151
+ ;(function($){
8152
+ $.jgrid.extend({
8153
+ groupingSetup : function () {
8154
+ return this.each(function (){
8155
+ var $t = this,
8156
+ grp = $t.p.groupingView;
8157
+ if(grp !== null && ( (typeof grp === 'object') || $.isFunction(grp) ) ) {
8158
+ if(!grp.groupField.length) {
8159
+ $t.p.grouping = false;
8160
+ } else {
8161
+ if ( typeof(grp.visibiltyOnNextGrouping) == 'undefined') {
8162
+ grp.visibiltyOnNextGrouping = [];
8163
+ }
8164
+ for(var i=0;i<grp.groupField.length;i++) {
8165
+ if(!grp.groupOrder[i]) {
8166
+ grp.groupOrder[i] = 'asc';
8167
+ }
8168
+ if(!grp.groupText[i]) {
8169
+ grp.groupText[i] = '{0}';
8170
+ }
8171
+ if( typeof(grp.groupColumnShow[i]) != 'boolean') {
8172
+ grp.groupColumnShow[i] = true;
8173
+ }
8174
+ if( typeof(grp.groupSummary[i]) != 'boolean') {
8175
+ grp.groupSummary[i] = false;
8176
+ }
8177
+ if(grp.groupColumnShow[i] === true) {
8178
+ grp.visibiltyOnNextGrouping[i] = true;
8179
+ $($t).jqGrid('showCol',grp.groupField[i]);
8180
+ } else {
8181
+ grp.visibiltyOnNextGrouping[i] = $("#"+$t.p.id+"_"+grp.groupField[i]).is(":visible");
8182
+ $($t).jqGrid('hideCol',grp.groupField[i]);
8183
+ }
8184
+ grp.sortitems[i] = [];
8185
+ grp.sortnames[i] = [];
8186
+ grp.summaryval[i] = [];
8187
+ if(grp.groupSummary[i]) {
8188
+ grp.summary[i] =[];
8189
+ var cm = $t.p.colModel;
8190
+ for(var j=0, cml = cm.length; j < cml; j++) {
8191
+ if(cm[j].summaryType) {
8192
+ grp.summary[i].push({nm:cm[j].name,st:cm[j].summaryType, v:''});
8193
+ }
8194
+ }
8195
+ }
8196
+ }
8197
+ $t.p.scroll = false;
8198
+ $t.p.rownumbers = false;
8199
+ $t.p.subGrid = false;
8200
+ $t.p.treeGrid = false;
8201
+ $t.p.gridview = true;
8202
+ }
8203
+ } else {
8204
+ $t.p.grouping = false;
8205
+ }
8206
+ });
8207
+ },
8208
+ groupingPrepare : function (rData, items, gdata, record) {
8209
+ this.each(function(){
8210
+ // currently only one level
8211
+ // Is this a good idea to do it so!!!!?????
8212
+ items[0] += "";
8213
+ var itm = items[0].toString().split(' ').join('');
8214
+
8215
+ var grp = this.p.groupingView, $t= this;
8216
+ if(gdata.hasOwnProperty(itm)) {
8217
+ gdata[itm].push(rData);
8218
+ } else {
8219
+ gdata[itm] = [];
8220
+ gdata[itm].push(rData);
8221
+ grp.sortitems[0].push(itm);
8222
+ grp.sortnames[0].push($.trim(items[0].toString()));
8223
+ grp.summaryval[0][itm] = $.extend(true,[],grp.summary[0]);
8224
+ }
8225
+ if(grp.groupSummary[0]) {
8226
+ $.each(grp.summaryval[0][itm],function() {
8227
+ if ($.isFunction(this.st)) {
8228
+ this.v = this.st.call($t, this.v, this.nm, record);
8229
+ } else {
8230
+ this.v = $($t).jqGrid('groupingCalculations.'+this.st, this.v, this.nm, record);
8231
+ }
8232
+ });
8233
+ }
8234
+ });
8235
+ return gdata;
8236
+ },
8237
+ groupingToggle : function(hid){
8238
+ this.each(function(){
8239
+ var $t = this,
8240
+ grp = $t.p.groupingView,
8241
+ strpos = hid.lastIndexOf('_'),
8242
+ uid = hid.substring(0,strpos+1),
8243
+ num = parseInt(hid.substring(strpos+1),10)+1,
8244
+ minus = grp.minusicon,
8245
+ plus = grp.plusicon,
8246
+ tar = $("#"+hid),
8247
+ r = tar.length ? tar[0].nextSibling : null,
8248
+ tarspan = $("#"+hid+" span."+"tree-wrap-"+$t.p.direction),
8249
+ collapsed = false;
8250
+ if( tarspan.hasClass(minus) ) {
8251
+ if(grp.showSummaryOnHide && grp.groupSummary[0]) {
8252
+ if(r){
8253
+ while(r) {
8254
+ if($(r).hasClass('jqfoot') ) { break; }
8255
+ $(r).hide();
8256
+ r = r.nextSibling;
8257
+ }
8258
+ }
8259
+ } else {
8260
+ if(r){
8261
+ while(r) {
8262
+ if($(r).attr('id') ==uid+String(num) ) { break; }
8263
+ $(r).hide();
8264
+ r = r.nextSibling;
8265
+ }
8266
+ }
8267
+ }
8268
+ tarspan.removeClass(minus).addClass(plus);
8269
+ collapsed = true;
8270
+ } else {
8271
+ if(r){
8272
+ while(r) {
8273
+ if($(r).attr('id') ==uid+String(num) ) { break; }
8274
+ $(r).show();
8275
+ r = r.nextSibling;
8276
+ }
8277
+ }
8278
+ tarspan.removeClass(plus).addClass(minus);
8279
+ }
8280
+ if( $.isFunction($t.p.onClickGroup)) { $t.p.onClickGroup.call($t, hid , collapsed); }
8281
+
8282
+ });
8283
+ return false;
8284
+ },
8285
+ groupingRender : function (grdata, colspans ) {
8286
+ return this.each(function(){
8287
+ var $t = this,
8288
+ grp = $t.p.groupingView,
8289
+ str = "", icon = "", hid, pmrtl = grp.groupCollapse ? grp.plusicon : grp.minusicon, gv, cp, ii;
8290
+ //only one level for now
8291
+ if(!grp.groupDataSorted) {
8292
+ // ???? TO BE IMPROVED
8293
+ grp.sortitems[0].sort();
8294
+ grp.sortnames[0].sort();
8295
+ if(grp.groupOrder[0].toLowerCase() == 'desc')
8296
+ {
8297
+ grp.sortitems[0].reverse();
8298
+ grp.sortnames[0].reverse();
8299
+ }
8300
+ }
8301
+ pmrtl += " tree-wrap-"+$t.p.direction;
8302
+ ii = 0;
8303
+ while(ii < colspans) {
8304
+ if($t.p.colModel[ii].name == grp.groupField[0]) {
8305
+ cp = ii;
8306
+ break;
8307
+ }
8308
+ ii++;
8309
+ }
8310
+ $.each(grp.sortitems[0],function(i,n){
8311
+ hid = $t.p.id+"ghead_"+i;
8312
+ icon = "<span style='cursor:pointer;' class='ui-icon "+pmrtl+"' onclick=\"jQuery('#"+$t.p.id+"').jqGrid('groupingToggle','"+hid+"');return false;\"></span>";
8313
+ try {
8314
+ gv = $t.formatter(hid, grp.sortnames[0][i], cp, grp.sortitems[0] );
8315
+ } catch (egv) {
8316
+ gv = grp.sortnames[0][i];
8317
+ }
8318
+ str += "<tr id=\""+hid+"\" role=\"row\" class= \"ui-widget-content jqgroup ui-row-"+$t.p.direction+"\"><td colspan=\""+colspans+"\">"+icon+$.jgrid.format(grp.groupText[0], gv, grdata[n].length)+"</td></tr>";
8319
+ for(var kk=0;kk<grdata[n].length;kk++) {
8320
+ str += grdata[n][kk].join('');
8321
+ }
8322
+ if(grp.groupSummary[0]) {
8323
+ var hhdr = "";
8324
+ if(grp.groupCollapse && !grp.showSummaryOnHide) {
8325
+ hhdr = " style=\"display:none;\"";
8326
+ }
8327
+ str += "<tr"+hhdr+" role=\"row\" class=\"ui-widget-content jqfoot ui-row-"+$t.p.direction+"\">";
8328
+ var fdata = grp.summaryval[0][n],
8329
+ cm = $t.p.colModel,
8330
+ vv, grlen = grdata[n].length;
8331
+ for(var k=0; k<colspans;k++) {
8332
+ var tmpdata = "<td "+$t.formatCol(k,1,'')+">&#160;</td>",
8333
+ tplfld = "{0}";
8334
+ $.each(fdata,function(){
8335
+ if(this.nm == cm[k].name) {
8336
+ if(cm[k].summaryTpl) {
8337
+ tplfld = cm[k].summaryTpl;
8338
+ }
8339
+ if(this.st == 'avg') {
8340
+ if(this.v && grlen > 0) {
8341
+ this.v = (this.v/grlen);
8342
+ }
8343
+ }
8344
+ try {
8345
+ vv = $t.formatter('', this.v, k, this);
8346
+ } catch (ef) {
8347
+ vv = this.v;
8348
+ }
8349
+ tmpdata= "<td "+$t.formatCol(k,1,'')+">"+$.jgrid.format(tplfld,vv)+ "</td>";
8350
+ return false;
8351
+ }
8352
+ });
8353
+ str += tmpdata;
8354
+ }
8355
+ str += "</tr>";
8356
+ }
8357
+ });
8358
+ $("#"+$t.p.id+" tbody:first").append(str);
8359
+ // free up memory
8360
+ str = null;
8361
+ });
8362
+ },
8363
+ groupingGroupBy : function (name, options ) {
8364
+ return this.each(function(){
8365
+ var $t = this;
8366
+ if(typeof(name) == "string") {
8367
+ name = [name];
8368
+ }
8369
+ var grp = $t.p.groupingView;
8370
+ $t.p.grouping = true;
8371
+
8372
+ //Set default, in case visibilityOnNextGrouping is undefined
8373
+ if (typeof grp.visibiltyOnNextGrouping == "undefined") {
8374
+ grp.visibiltyOnNextGrouping = [];
8375
+ }
8376
+ var i;
8377
+ // show previous hidden groups if they are hidden and weren't removed yet
8378
+ for(i=0;i<grp.groupField.length;i++) {
8379
+ if(!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) {
8380
+ $($t).jqGrid('showCol',grp.groupField[i]);
8381
+ }
8382
+ }
8383
+ // set visibility status of current group columns on next grouping
8384
+ for(i=0;i<name.length;i++) {
8385
+ grp.visibiltyOnNextGrouping[i] = $("#"+$t.p.id+"_"+name[i]).is(":visible");
8386
+ }
8387
+ $t.p.groupingView = $.extend($t.p.groupingView, options || {});
8388
+ grp.groupField = name;
8389
+ $($t).trigger("reloadGrid");
8390
+ });
8391
+ },
8392
+ groupingRemove : function (current) {
8393
+ return this.each(function(){
8394
+ var $t = this;
8395
+ if(typeof(current) == 'undefined') {
8396
+ current = true;
8397
+ }
8398
+ $t.p.grouping = false;
8399
+ if(current===true) {
8400
+ var grp = $t.p.groupingView;
8401
+ // show previous hidden groups if they are hidden and weren't removed yet
8402
+ for(var i=0;i<grp.groupField.length;i++) {
8403
+ if (!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) {
8404
+ $($t).jqGrid('showCol', grp.groupField);
8405
+ }
8406
+ }
8407
+ $("tr.jqgroup, tr.jqfoot","#"+$t.p.id+" tbody:first").remove();
8408
+ $("tr.jqgrow:hidden","#"+$t.p.id+" tbody:first").show();
8409
+ } else {
8410
+ $($t).trigger("reloadGrid");
8411
+ }
8412
+ });
8413
+ },
8414
+ groupingCalculations : {
8415
+ "sum" : function(v, field, rc) {
8416
+ return parseFloat(v||0) + parseFloat((rc[field]||0));
8417
+ },
8418
+ "min" : function(v, field, rc) {
8419
+ if(v==="") {
8420
+ return parseFloat(rc[field]||0);
8421
+ }
8422
+ return Math.min(parseFloat(v),parseFloat(rc[field]||0));
8423
+ },
8424
+ "max" : function(v, field, rc) {
8425
+ if(v==="") {
8426
+ return parseFloat(rc[field]||0);
8427
+ }
8428
+ return Math.max(parseFloat(v),parseFloat(rc[field]||0));
8429
+ },
8430
+ "count" : function(v, field, rc) {
8431
+ if(v==="") {v=0;}
8432
+ if(rc.hasOwnProperty(field)) {
8433
+ return v+1;
8434
+ } else {
8435
+ return 0;
8436
+ }
8437
+ },
8438
+ "avg" : function(v, field, rc) {
8439
+ // the same as sum, but at end we divide it
8440
+ return parseFloat(v||0) + parseFloat((rc[field]||0));
8441
+ }
8442
+ }
8443
+ });
8444
+ })(jQuery);
8436
8445
  ;(function($){
8437
8446
  /*
8438
8447
  * jqGrid extension for constructing Grid Data from external file
@@ -8643,32 +8652,43 @@ $.jgrid.extend({
8643
8652
  * http://www.gnu.org/licenses/gpl-2.0.html
8644
8653
  **/
8645
8654
  //jsHint options
8646
- /*global alert */
8655
+ /*global alert, $, jQuery */
8647
8656
  "use strict";
8648
8657
  $.jgrid.inlineEdit = $.jgrid.inlineEdit || {};
8649
8658
  $.jgrid.extend({
8650
8659
  //Editing
8651
8660
  editRow : function(rowid,keys,oneditfunc,successfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
8652
8661
  // Compatible mode old versions
8653
- var settings = {
8654
- "keys" : keys || false,
8655
- "oneditfunc" : oneditfunc || null,
8656
- "successfunc" : successfunc || null,
8657
- "url" : url || null,
8658
- "extraparam" : extraparam || {},
8659
- "aftersavefunc" : aftersavefunc || null,
8660
- "errorfunc": errorfunc || null,
8661
- "afterrestorefunc" : afterrestorefunc|| null,
8662
- "restoreAfterError" : true,
8663
- "mtype" : "POST"
8664
- },
8665
- args = $.makeArray(arguments).slice(1), o;
8662
+ var o={}, args = $.makeArray(arguments).slice(1);
8666
8663
 
8667
- if(args[0] && typeof(args[0]) == "object" && !$.isFunction(args[0])) {
8668
- o = $.extend($.jgrid.inlineEdit, settings, args[0]);
8664
+ if( $.jgrid.realType(args[0]) === "Object" ) {
8665
+ o = args[0];
8669
8666
  } else {
8670
- o = settings;
8671
- }
8667
+ if (typeof keys !== "undefined") { o.keys = keys; }
8668
+ if ($.isFunction(oneditfunc)) { o.oneditfunc = oneditfunc; }
8669
+ if ($.isFunction(successfunc)) { o.successfunc = successfunc; }
8670
+ if (typeof url !== "undefined") { o.url = url; }
8671
+ if (typeof extraparam !== "undefined") { o.extraparam = extraparam; }
8672
+ if ($.isFunction(aftersavefunc)) { o.aftersavefunc = aftersavefunc; }
8673
+ if ($.isFunction(errorfunc)) { o.errorfunc = errorfunc; }
8674
+ if ($.isFunction(afterrestorefunc)) { o.afterrestorefunc = afterrestorefunc; }
8675
+ // last two not as param, but as object (sorry)
8676
+ //if (typeof restoreAfterError !== "undefined") { o.restoreAfterError = restoreAfterError; }
8677
+ //if (typeof mtype !== "undefined") { o.mtype = mtype || "POST"; }
8678
+ }
8679
+ o = $.extend(true, {
8680
+ keys : false,
8681
+ oneditfunc: null,
8682
+ successfunc: null,
8683
+ url: null,
8684
+ extraparam: {},
8685
+ aftersavefunc: null,
8686
+ errorfunc: null,
8687
+ afterrestorefunc: null,
8688
+ restoreAfterError: true,
8689
+ mtype: "POST"
8690
+ }, $.jgrid.inlineEdit, o );
8691
+
8672
8692
  // End compatible
8673
8693
  return this.each(function(){
8674
8694
  var $t = this, nm, tmp, editable, cnt=0, focus=null, svr={}, ind,cm;
@@ -8736,24 +8756,30 @@ $.jgrid.extend({
8736
8756
  },
8737
8757
  saveRow : function(rowid, successfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
8738
8758
  // Compatible mode old versions
8739
- var settings = {
8740
- "successfunc" : successfunc || null,
8741
- "url" : url || null,
8742
- "extraparam" : extraparam || {},
8743
- "aftersavefunc" : aftersavefunc || null,
8744
- "errorfunc": errorfunc || null,
8745
- "afterrestorefunc" : afterrestorefunc|| null,
8746
- "restoreAfterError" : true,
8747
- "mtype" : "POST"
8748
- },
8749
- args = $.makeArray(arguments).slice(1), o;
8759
+ var args = $.makeArray(arguments).slice(1), o = {};
8750
8760
 
8751
- if(args[0] && typeof(args[0]) == "object" && !$.isFunction(args[0])) {
8752
- o = $.extend($.jgrid.inlineEdit, settings, args[0]);
8761
+ if( $.jgrid.realType(args[0]) === "Object" ) {
8762
+ o = args[0];
8753
8763
  } else {
8754
- o = settings;
8755
- }
8764
+ if ($.isFunction(successfunc)) { o.successfunc = successfunc; }
8765
+ if (typeof url !== "undefined") { o.url = url; }
8766
+ if (typeof extraparam !== "undefined") { o.extraparam = extraparam; }
8767
+ if ($.isFunction(aftersavefunc)) { o.aftersavefunc = aftersavefunc; }
8768
+ if ($.isFunction(errorfunc)) { o.errorfunc = errorfunc; }
8769
+ if ($.isFunction(afterrestorefunc)) { o.afterrestorefunc = afterrestorefunc; }
8770
+ }
8771
+ o = $.extend(true, {
8772
+ successfunc: null,
8773
+ url: null,
8774
+ extraparam: {},
8775
+ aftersavefunc: null,
8776
+ errorfunc: null,
8777
+ afterrestorefunc: null,
8778
+ restoreAfterError: true,
8779
+ mtype: "POST"
8780
+ }, $.jgrid.inlineEdit, o );
8756
8781
  // End compatible
8782
+
8757
8783
  var success = false;
8758
8784
  var $t = this[0], nm, tmp={}, tmp2={}, tmp3= {}, editable, fr, cv, ind;
8759
8785
  if (!$t.grid ) { return success; }
@@ -8805,9 +8831,9 @@ $.jgrid.extend({
8805
8831
  if (tmp[nm] === undefined) { throw "e2"; }
8806
8832
  } else { throw "e1"; }
8807
8833
  } catch (e) {
8808
- if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
8809
- if (e=="e2") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
8810
- else { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
8834
+ if (e=="e1") { $.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,$.jgrid.edit.bClose); }
8835
+ if (e=="e2") { $.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose); }
8836
+ else { $.jgrid.info_dialog($.jgrid.errors.errcap,e.message,$.jgrid.edit.bClose); }
8811
8837
  }
8812
8838
  break;
8813
8839
  }
@@ -8914,7 +8940,7 @@ $.jgrid.extend({
8914
8940
  o.errorfunc.call($t, rowid, res, stat);
8915
8941
  } else {
8916
8942
  try {
8917
- jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+ res.responseText +'</div>', jQuery.jgrid.edit.bClose,{buttonalign:'right'});
8943
+ $.jgrid.info_dialog($.jgrid.errors.errcap,'<div class="ui-state-error">'+ res.responseText +'</div>', $.jgrid.edit.bClose,{buttonalign:'right'});
8918
8944
  } catch(e) {
8919
8945
  alert(res.responseText);
8920
8946
  }
@@ -8930,16 +8956,15 @@ $.jgrid.extend({
8930
8956
  },
8931
8957
  restoreRow : function(rowid, afterrestorefunc) {
8932
8958
  // Compatible mode old versions
8933
- var settings = {
8934
- "afterrestorefunc" : afterrestorefunc|| null
8935
- },
8936
- args = $.makeArray(arguments).slice(1), o;
8959
+ var args = $.makeArray(arguments).slice(1), o={};
8937
8960
 
8938
- if(args[0] && typeof(args[0]) == "object" && !$.isFunction(args[0])) {
8939
- o = $.extend($.jgrid.inlineEdit, settings, args[0]);
8961
+ if( $.jgrid.realType(args[0]) === "Object" ) {
8962
+ o = args[0];
8940
8963
  } else {
8941
- o = settings;
8964
+ if ($.isFunction(afterrestorefunc)) { o.afterrestorefunc = afterrestorefunc; }
8942
8965
  }
8966
+ o = $.extend(true, $.jgrid.inlineEdit, o );
8967
+
8943
8968
  // End compatible
8944
8969
 
8945
8970
  return this.each(function(){
@@ -8975,11 +9000,11 @@ $.jgrid.extend({
8975
9000
  });
8976
9001
  },
8977
9002
  addRow : function ( p ) {
8978
- p = $.extend({
9003
+ p = $.extend(true, {
8979
9004
  rowID : "new_row",
8980
9005
  initdata : {},
8981
9006
  position :"first",
8982
- useDefValues : false,
9007
+ useDefValues : true,
8983
9008
  useFormatter : false,
8984
9009
  addRowParams : {extraparam:{}}
8985
9010
  },p || {});
@@ -8988,7 +9013,7 @@ $.jgrid.extend({
8988
9013
  var $t = this;
8989
9014
  if(p.useDefValues === true) {
8990
9015
  $($t.p.colModel).each(function(i){
8991
- if( this.edioptions && this.editoptions.defaultValue ) {
9016
+ if( this.editoptions && this.editoptions.defaultValue ) {
8992
9017
  var opt = this.editoptions.defaultValue,
8993
9018
  tmp = $.isFunction(opt) ? opt.call($t) : opt;
8994
9019
  p.initdata[this.name] = tmp;
@@ -9100,7 +9125,7 @@ $.jgrid.extend({
9100
9125
  buttonicon : o.saveicon,
9101
9126
  id : $t.p.id+"_ilsave",
9102
9127
  onClickButton : function ( e ) {
9103
- var sr = $($t).jqGrid('getGridParam','selrow');
9128
+ var sr = $t.p.savedRow[0].id;
9104
9129
  if(sr) {
9105
9130
  if($("#"+$.jgrid.jqID(sr), "#"+$.jgrid.jqID($t.p.id) ).hasClass("jqgrid-new-row")) {
9106
9131
  var opers = $t.p.prmNames,
@@ -9110,11 +9135,12 @@ $.jgrid.extend({
9110
9135
  }
9111
9136
  o.editParams.extraparam[oper] = opers.addoper;
9112
9137
  }
9113
- $($t).jqGrid('saveRow', sr, o.editParams);
9114
- $("#"+$t.p.id+"_ilsave").addClass('ui-state-disabled');
9115
- $("#"+$t.p.id+"_ilcancel").addClass('ui-state-disabled');
9116
- $("#"+$t.p.id+"_iladd").removeClass('ui-state-disabled');
9117
- $("#"+$t.p.id+"_iledit").removeClass('ui-state-disabled');
9138
+ if( $($t).jqGrid('saveRow', sr, o.editParams) ) {
9139
+ $("#"+$t.p.id+"_ilsave").addClass('ui-state-disabled');
9140
+ $("#"+$t.p.id+"_ilcancel").addClass('ui-state-disabled');
9141
+ $("#"+$t.p.id+"_iladd").removeClass('ui-state-disabled');
9142
+ $("#"+$t.p.id+"_iledit").removeClass('ui-state-disabled');
9143
+ }
9118
9144
  } else {
9119
9145
  $.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+$t.p.id,jqm:true});$("#jqg_alrt").focus();
9120
9146
  }
@@ -9129,7 +9155,7 @@ $.jgrid.extend({
9129
9155
  buttonicon : o.cancelicon,
9130
9156
  id : $t.p.id+"_ilcancel",
9131
9157
  onClickButton : function ( e ) {
9132
- var sr = $($t).jqGrid('getGridParam','selrow');
9158
+ var sr = $t.p.savedRow[0].id;
9133
9159
  if(sr) {
9134
9160
  $($t).jqGrid('restoreRow', sr, o.editParams);
9135
9161
  $("#"+$t.p.id+"_ilsave").addClass('ui-state-disabled');
@@ -9692,7 +9718,7 @@ addSubGridCell :function (pos,iRow) {
9692
9718
  sid= this.p.id;
9693
9719
  ic = this.p.subGridOptions.plusicon;
9694
9720
  });
9695
- return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" class=\"ui-sgcollapsed sgcollapsed\" "+prp+"><a href='javascript:void(0);'><span class='ui-icon "+ic+"'></span></a></td>";
9721
+ return "<td role=\"gridcell\" aria-describedby=\""+sid+"_subgrid\" class=\"ui-sgcollapsed sgcollapsed\" "+prp+"><a href='javascript:void(0);'><span class='ui-icon "+ic+"'></span></a></td>";
9696
9722
  },
9697
9723
  addSubGrid : function( pos, sind ) {
9698
9724
  return this.each(function(){
@@ -11274,17 +11300,17 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11274
11300
  if( !$.fmatter.isUndefined($('#'+gid)[0].p.delOptions) ) {
11275
11301
  op.delOptions = $('#'+gid)[0].p.delOptions;
11276
11302
  }
11277
- var saverow = function( rowid) {
11278
- if(op.afterSave) op.afterSave(rowid);
11303
+ var $t = $("#"+gid)[0];
11304
+ var saverow = function( rowid, res) {
11305
+ if(op.afterSave) op.afterSave.call($t, rowid, res);
11279
11306
  $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid + ".ui-jqgrid-btable:first").show();
11280
11307
  $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
11281
11308
  },
11282
11309
  restorerow = function( rowid) {
11283
- if(op.afterRestore) op.afterRestore(rowid);
11310
+ if(op.afterRestore) op.afterRestore.call($t, rowid);
11284
11311
  $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show();
11285
11312
  $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
11286
11313
  };
11287
- var $t = $("#"+gid)[0];
11288
11314
  if( $("#"+rid,"#"+gid).hasClass("jqgrid-new-row") ){
11289
11315
  var opers = $t.p.prmNames,
11290
11316
  oper = opers.oper;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jqgrid-jquery-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0.0
4
+ version: 4.3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doc Walker