jqgrid-jquery-rails 4.4.1.0 → 4.4.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,172 @@
1
+ ;(function($){
2
+ /**
3
+ * jqGrid English Translation
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.html
9
+ **/
10
+ $.jgrid = $.jgrid || {};
11
+ $.extend($.jgrid,{
12
+ defaults : {
13
+ recordtext: "Data {0} - {1} dari {2}",
14
+ emptyrecords: "Tidak ada data",
15
+ loadtext: "Memuat...",
16
+ pgtext : "Halaman {0} dari {1}"
17
+ },
18
+ search : {
19
+ caption: "Pencarian",
20
+ Find: "Cari !",
21
+ Reset: "Segarkan",
22
+ odata : ['sama dengan', 'tidak sama dengan', 'kurang dari',
23
+ 'kurang dari atau sama dengan','lebih besar','lebih besar atau sama dengan',
24
+ 'dimulai dengan','tidak dimulai dengan','di dalam','tidak di dalam','diakhiri dengan',
25
+ 'tidak diakhiri dengan','mengandung','tidak mengandung'],
26
+ groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
27
+ matchText: " match",
28
+ rulesText: " rules"
29
+ },
30
+ edit : {
31
+ addCaption: "Tambah Data",
32
+ editCaption: "Sunting Data",
33
+ bSubmit: "Submit",
34
+ bCancel: "Tutup",
35
+ bClose: "Tutup",
36
+ saveData: "Data telah berubah! Simpan perubahan?",
37
+ bYes : "Ya",
38
+ bNo : "Tidak",
39
+ bExit : "Tutup",
40
+ msg: {
41
+ required:"kolom wajib diisi",
42
+ number:"hanya nomer yang diperbolehkan",
43
+ minValue:"kolom harus lebih besar dari atau sama dengan",
44
+ maxValue:"kolom harus lebih kecil atau sama dengan",
45
+ email: "alamat e-mail tidak valid",
46
+ integer: "hanya nilai integer yang diperbolehkan",
47
+ date: "nilai tanggal tidak valid",
48
+ url: "Bukan URL yang valid. Harap gunakan ('http://' or 'https://')",
49
+ nodefined : " belum didefinisikan!",
50
+ novalue : " return value is required!",
51
+ customarray : "Custom function should return array!",
52
+ customfcheck : "Custom function should be present in case of custom checking!"
53
+
54
+ }
55
+ },
56
+ view : {
57
+ caption: "Menampilkan data",
58
+ bClose: "Tutup"
59
+ },
60
+ del : {
61
+ caption: "Hapus",
62
+ msg: "Hapus data terpilih?",
63
+ bSubmit: "Hapus",
64
+ bCancel: "Batalkan"
65
+ },
66
+ nav : {
67
+ edittext: "",
68
+ edittitle: "Sunting data terpilih",
69
+ addtext:"",
70
+ addtitle: "Tambah baris baru",
71
+ deltext: "",
72
+ deltitle: "Hapus baris terpilih",
73
+ searchtext: "",
74
+ searchtitle: "Temukan data",
75
+ refreshtext: "",
76
+ refreshtitle: "Segarkan Grid",
77
+ alertcap: "Warning",
78
+ alerttext: "Harap pilih baris",
79
+ viewtext: "",
80
+ viewtitle: "Tampilkan baris terpilih"
81
+ },
82
+ col : {
83
+ caption: "Pilih Kolom",
84
+ bSubmit: "Ok",
85
+ bCancel: "Batal"
86
+ },
87
+ errors : {
88
+ errcap : "Error",
89
+ nourl : "Tidak ada url yang diset",
90
+ norecords: "Tidak ada data untuk diproses",
91
+ model : "Lebar dari colNames <> colModel!"
92
+ },
93
+ formatter : {
94
+ integer : {thousandsSeparator: ".", defaultValue: '0'},
95
+ number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0'},
96
+ currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "Rp. ", suffix:"", defaultValue: '0'},
97
+ date : {
98
+ dayNames: [
99
+ "Ming", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab",
100
+ "Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"
101
+ ],
102
+ monthNames: [
103
+ "Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des",
104
+ "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
105
+ ],
106
+ AmPm : ["am","pm","AM","PM"],
107
+ S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th';},
108
+ srcformat: 'Y-m-d',
109
+ newformat: 'n/j/Y',
110
+ masks : {
111
+ // see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
112
+ // and see http://docs.jquery.com/UI/Datepicker/formatDate
113
+ // and https://github.com/jquery/globalize#dates for alternative formats used frequently
114
+ // one can find on https://github.com/jquery/globalize/tree/master/lib/cultures many
115
+ // information about date, time, numbers and currency formats used in different countries
116
+ // one should just convert the information in PHP format
117
+ ISO8601Long:"Y-m-d H:i:s",
118
+ ISO8601Short:"Y-m-d",
119
+ // short date:
120
+ // n - Numeric representation of a month, without leading zeros
121
+ // j - Day of the month without leading zeros
122
+ // Y - A full numeric representation of a year, 4 digits
123
+ // example: 3/1/2012 which means 1 March 2012
124
+ ShortDate: "n/j/Y", // in jQuery UI Datepicker: "M/d/yyyy"
125
+ // long date:
126
+ // l - A full textual representation of the day of the week
127
+ // F - A full textual representation of a month
128
+ // d - Day of the month, 2 digits with leading zeros
129
+ // Y - A full numeric representation of a year, 4 digits
130
+ LongDate: "l, F d, Y", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy"
131
+ // long date with long time:
132
+ // l - A full textual representation of the day of the week
133
+ // F - A full textual representation of a month
134
+ // d - Day of the month, 2 digits with leading zeros
135
+ // Y - A full numeric representation of a year, 4 digits
136
+ // g - 12-hour format of an hour without leading zeros
137
+ // i - Minutes with leading zeros
138
+ // s - Seconds, with leading zeros
139
+ // A - Uppercase Ante meridiem and Post meridiem (AM or PM)
140
+ FullDateTime: "l, F d, Y g:i:s A", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy h:mm:ss tt"
141
+ // month day:
142
+ // F - A full textual representation of a month
143
+ // d - Day of the month, 2 digits with leading zeros
144
+ MonthDay: "F d", // in jQuery UI Datepicker: "MMMM dd"
145
+ // short time (without seconds)
146
+ // g - 12-hour format of an hour without leading zeros
147
+ // i - Minutes with leading zeros
148
+ // A - Uppercase Ante meridiem and Post meridiem (AM or PM)
149
+ ShortTime: "g:i A", // in jQuery UI Datepicker: "h:mm tt"
150
+ // long time (with seconds)
151
+ // g - 12-hour format of an hour without leading zeros
152
+ // i - Minutes with leading zeros
153
+ // s - Seconds, with leading zeros
154
+ // A - Uppercase Ante meridiem and Post meridiem (AM or PM)
155
+ LongTime: "g:i:s A", // in jQuery UI Datepicker: "h:mm:ss tt"
156
+ SortableDateTime: "Y-m-d\\TH:i:s",
157
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
158
+ // month with year
159
+ // Y - A full numeric representation of a year, 4 digits
160
+ // F - A full textual representation of a month
161
+ YearMonth: "F, Y" // in jQuery UI Datepicker: "MMMM, yyyy"
162
+ },
163
+ reformatAfterEdit : false
164
+ },
165
+ baseLinkUrl: '',
166
+ showAction: '',
167
+ target: '',
168
+ checkbox : {disabled:true},
169
+ idName : 'id'
170
+ }
171
+ });
172
+ })(jQuery);
@@ -1 +1 @@
1
- (function(a){a.jgrid= a.jgrid || {};a.jgrid.defaults={recordtext:"Rad {0} - {1}, totalt {2}",loadtext:"Laster...",pgtext:"Side {0} av {1}"};a.jgrid.search={caption:"S�k...",Find:"Finn",Reset:"Nullstill",odata:["lik","forskjellig fra","mindre enn","mindre eller lik","st�rre enn"," st�rre eller lik","starter med","slutter med","inneholder"]};a.jgrid.edit={addCaption:"Ny rad",editCaption:"Rediger",bSubmit:"Send",bCancel:"Avbryt",bClose:"Lukk",processData:"Laster...",msg:{required:"Felt er obligatorisk",number:"Legg inn et gyldig tall",minValue:"verdi m� v�re st�rre enn eller lik",maxValue:"verdi m� v�re mindre enn eller lik",email:"er ikke en gyldig e-post adresse",integer:"Legg inn et gyldig heltall",date:"Legg inn en gyldig dato",url:"er ikke en gyldig URL. Prefiks p�krevd ('http://' eller 'https://')",nodefined:" er ikke definert!",novalue:" returverdi er p�krevd!",customarray:"Tilpasset funksjon m� returnere en tabell!",customfcheck:"Tilpasset funksjon m� eksistere!"}};a.jgrid.view={caption:"�pne post",bClose:"Lukk"};a.jgrid.del={caption:"Slett",msg:"Slett valgte rad(er)?",bSubmit:"Slett",bCancel:"Avbryt",processData:"Behandler..."};a.jgrid.nav={edittext:" ",edittitle:"Rediger valgte rad(er)",addtext:" ",addtitle:"Legg til ny rad",deltext:" ",deltitle:"Slett valgte rad(er)",searchtext:" ",searchtitle:"S�k",refreshtext:"",refreshtitle:"Oppdater tabell",alertcap:"Advarsel",alerttext:"Velg rad",viewtext:" ",viewtitle:"�pne valgt rad"};a.jgrid.col={caption:"Vis/skjul kolonner",bSubmit:"Utf�r",bCancel:"Avbryt"};a.jgrid.errors={errcap:"Feil",nourl:"Ingen url er satt",norecords:"Ingen poster � behandle",model:"colNames og colModel har forskjellig lengde!"};a.jgrid.formatter={integer:{thousandsSeparator:" ",defaulValue:0},number:{decimalSeparator:",",thousandsSeparator:" ",decimalPlaces:2,defaulValue:0},currency:{decimalSeparator:",",thousandsSeparator:" ",decimalPlaces:2,prefix:"",suffix:"",defaulValue:0},date:{dayNames:["s�.","ma.","ti.","on.","to.","fr.","l�.","S�ndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","L�rdag"],monthNames:["jan.","feb.","mars","april","mai","juni","juli","aug.","sep.","okt.","nov.","des.","januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],AmPm:["","","",""],S:function(b){return"."},srcformat:"Y-m-d H:i:s",newformat:"Y-m-d H:i:s",masks:{ISO8601Long:"Y-m-d H:i:s",ISO8601Short:"Y-m-d",ShortDate:"j.n.Y",LongDate:"l j. F Y",FullDateTime:"l j. F Y kl. G.i.s",MonthDay:"j. F",ShortTime:"H:i",LongTime:"H:i:s",SortableDateTime:"Y-m-d\\TH:i:s",UniversalSortableDateTime:"Y-m-d H:i:sO",YearMonth:"F Y"},reformatAfterEdit:false},baseLinkUrl:"",showAction:"show",addParam:"",checkbox:{disabled:true}}})(jQuery);
1
+ (function(a){a.jgrid= a.jgrid || {};a.jgrid.defaults={recordtext:"Rad {0} - {1}, totalt {2}",loadtext:"Laster...",pgtext:"Side {0} av {1}"};a.jgrid.search={caption:"S�k...",Find:"Finn",Reset:"Nullstill",odata:["lik","forskjellig fra","mindre enn","mindre eller lik","st�rre enn"," st�rre eller lik","starter med","slutter med","inneholder"]};a.jgrid.edit={addCaption:"Ny rad",editCaption:"Rediger",bSubmit:"Send",bCancel:"Avbryt",bClose:"Lukk",processData:"Laster...",msg:{required:"Felt er obligatorisk",number:"Legg inn et gyldig tall",minValue:"verdi m� v�re st�rre enn eller lik",maxValue:"verdi m� v�re mindre enn eller lik",email:"er ikke en gyldig e-post adresse",integer:"Legg inn et gyldig heltall",date:"Legg inn en gyldig dato",url:"er ikke en gyldig URL. Prefiks p�krevd ('http://' eller 'https://')",nodefined:" er ikke definert!",novalue:" returverdi er p�krevd!",customarray:"Tilpasset funksjon m� returnere en tabell!",customfcheck:"Tilpasset funksjon m� eksistere!"}};a.jgrid.view={caption:"�pne post",bClose:"Lukk"};a.jgrid.del={caption:"Slett",msg:"Slett valgte rad(er)?",bSubmit:"Slett",bCancel:"Avbryt",processData:"Behandler..."};a.jgrid.nav={edittext:" ",edittitle:"Rediger valgte rad(er)",addtext:" ",addtitle:"Legg til ny rad",deltext:" ",deltitle:"Slett valgte rad(er)",searchtext:" ",searchtitle:"S�k",refreshtext:"",refreshtitle:"Oppdater tabell",alertcap:"Advarsel",alerttext:"Velg rad",viewtext:" ",viewtitle:"�pne valgt rad"};a.jgrid.col={caption:"Vis/skjul kolonner",bSubmit:"Utf�r",bCancel:"Avbryt"};a.jgrid.errors={errcap:"Feil",nourl:"Ingen url er satt",norecords:"Ingen poster � behandle",model:"colNames og colModel har forskjellig lengde!"};a.jgrid.formatter={integer:{thousandsSeparator:" ",defaultValue:0},number:{decimalSeparator:",",thousandsSeparator:" ",decimalPlaces:2,defaulValue:0},currency:{decimalSeparator:",",thousandsSeparator:" ",decimalPlaces:2,prefix:"",suffix:"",defaulValue:0},date:{dayNames:["s�.","ma.","ti.","on.","to.","fr.","l�.","S�ndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","L�rdag"],monthNames:["jan.","feb.","mars","april","mai","juni","juli","aug.","sep.","okt.","nov.","des.","januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],AmPm:["","","",""],S:function(b){return"."},srcformat:"Y-m-d H:i:s",newformat:"Y-m-d H:i:s",masks:{ISO8601Long:"Y-m-d H:i:s",ISO8601Short:"Y-m-d",ShortDate:"j.n.Y",LongDate:"l j. F Y",FullDateTime:"l j. F Y kl. G.i.s",MonthDay:"j. F",ShortTime:"H:i",LongTime:"H:i:s",SortableDateTime:"Y-m-d\\TH:i:s",UniversalSortableDateTime:"Y-m-d H:i:sO",YearMonth:"F Y"},reformatAfterEdit:false},baseLinkUrl:"",showAction:"show",addParam:"",checkbox:{disabled:true}}})(jQuery);
@@ -42,11 +42,11 @@ $.extend($.jgrid,{
42
42
  email: "некорректное значение e-mail",
43
43
  integer: "Пожалуйста, введите целое число",
44
44
  date: "Пожалуйста, введите правильную дату",
45
- url: "неверная ссылка. Необходимо ввести префикс ('http://' or 'https://')",
46
- nodefined : " is not defined!",
47
- novalue : " return value is required!",
48
- customarray : "Custom function should return array!",
49
- customfcheck : "Custom function should be present in case of custom checking!"
45
+ url: "неверная ссылка. Необходимо ввести префикс ('http://' или 'https://')",
46
+ nodefined : " не определено!",
47
+ novalue : " возвращаемое значение обязательно!",
48
+ customarray : "Пользовательская функция должна возвращать массив!",
49
+ customfcheck : "Пользовательская функция должна присутствовать в случаи пользовательской проверки!"
50
50
  }
51
51
  },
52
52
  view : {
@@ -0,0 +1,169 @@
1
+ ;(function($){
2
+ /**
3
+ * jqGrid Vietnamese Translation
4
+ * Lê Đình Dũng dungtdc@gmail.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.html
9
+ **/
10
+ $.jgrid = $.jgrid || {};
11
+ $.extend($.jgrid,{
12
+ defaults : {
13
+ recordtext: "View {0} - {1} of {2}",
14
+ emptyrecords: "Không có dữ liệu",
15
+ loadtext: "Đang nạp dữ liệu...",
16
+ pgtext : "Trang {0} trong tổng số {1}"
17
+ },
18
+ search : {
19
+ caption: "Tìm kiếm...",
20
+ Find: "Tìm",
21
+ Reset: "Khởi tạo lại",
22
+ odata : ['bằng', 'không bằng', 'bé hơn', 'bé hơn hoặc bằng','lớn hơn','lớn hơn hoặc bằng', 'bắt đầu với','không bắt đầu với','trong','không nằm trong','kết thúc với','không kết thúc với','chứa','không chứa'],
23
+ groupOps: [ { op: "VÀ", text: "tất cả" }, { op: "HOẶC", text: "bất kỳ" } ],
24
+ matchText: " đúng",
25
+ rulesText: " quy tắc"
26
+ },
27
+ edit : {
28
+ addCaption: "Thêm bản ghi",
29
+ editCaption: "Sửa bản ghi",
30
+ bSubmit: "Gửi",
31
+ bCancel: "Hủy bỏ",
32
+ bClose: "Đóng",
33
+ saveData: "Dữ liệu đã thay đổi! Có lưu thay đổi không?",
34
+ bYes : "Có",
35
+ bNo : "Không",
36
+ bExit : "Hủy bỏ",
37
+ msg: {
38
+ required:"Trường dữ liệu bắt buộc có",
39
+ number:"Hãy điền đúng số",
40
+ minValue:"giá trị phải lớn hơn hoặc bằng với ",
41
+ maxValue:"giá trị phải bé hơn hoặc bằng",
42
+ email: "không phải là một email đúng",
43
+ integer: "Hãy điền đúng số nguyên",
44
+ date: "Hãy điền đúng ngày tháng",
45
+ url: "không phải là URL. Khởi đầu bắt buộc là ('http://' hoặc 'https://')",
46
+ nodefined : " chưa được định nghĩa!",
47
+ novalue : " giá trị trả về bắt buộc phải có!",
48
+ customarray : "Hàm nên trả về một mảng!",
49
+ customfcheck : "Custom function should be present in case of custom checking!"
50
+
51
+ }
52
+ },
53
+ view : {
54
+ caption: "Xem bản ghi",
55
+ bClose: "Đóng"
56
+ },
57
+ del : {
58
+ caption: "Xóa",
59
+ msg: "Xóa bản ghi đã chọn?",
60
+ bSubmit: "Xóa",
61
+ bCancel: "Hủy bỏ"
62
+ },
63
+ nav : {
64
+ edittext: "",
65
+ edittitle: "Sửa dòng đã chọn",
66
+ addtext:"",
67
+ addtitle: "Thêm mới 1 dòng",
68
+ deltext: "",
69
+ deltitle: "Xóa dòng đã chọn",
70
+ searchtext: "",
71
+ searchtitle: "Tìm bản ghi",
72
+ refreshtext: "",
73
+ refreshtitle: "Nạp lại lưới",
74
+ alertcap: "Cảnh báo",
75
+ alerttext: "Hãy chọn một dòng",
76
+ viewtext: "",
77
+ viewtitle: "Xem dòng đã chọn"
78
+ },
79
+ col : {
80
+ caption: "Chọn cột",
81
+ bSubmit: "OK",
82
+ bCancel: "Hủy bỏ"
83
+ },
84
+ errors : {
85
+ errcap : "Lỗi",
86
+ nourl : "không url được đặt",
87
+ norecords: "Không có bản ghi để xử lý",
88
+ model : "Chiều dài của colNames <> colModel!"
89
+ },
90
+ formatter : {
91
+ integer : {thousandsSeparator: ".", defaultValue: '0'},
92
+ number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0'},
93
+ currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0'},
94
+ date : {
95
+ dayNames: [
96
+ "CN", "T2", "T3", "T4", "T5", "T6", "T7",
97
+ "Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"
98
+ ],
99
+ monthNames: [
100
+ "Th1", "Th2", "Th3", "Th4", "Th5", "Th6", "Th7", "Th8", "Th9", "Th10", "Th11", "Th12",
101
+ "Tháng một", "Tháng hai", "Tháng ba", "Tháng tư", "Tháng năm", "Tháng sáu", "Tháng bảy", "Tháng tám", "Tháng chín", "Tháng mười", "Tháng mười một", "Tháng mười hai"
102
+ ],
103
+ AmPm : ["sáng","chiều","SÁNG","CHIỀU"],
104
+ S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th';},
105
+ srcformat: 'Y-m-d',
106
+ newformat: 'n/j/Y',
107
+ masks : {
108
+ // see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
109
+ // and see http://docs.jquery.com/UI/Datepicker/formatDate
110
+ // and https://github.com/jquery/globalize#dates for alternative formats used frequently
111
+ // one can find on https://github.com/jquery/globalize/tree/master/lib/cultures many
112
+ // information about date, time, numbers and currency formats used in different countries
113
+ // one should just convert the information in PHP format
114
+ ISO8601Long:"Y-m-d H:i:s",
115
+ ISO8601Short:"Y-m-d",
116
+ // short date:
117
+ // n - Numeric representation of a month, without leading zeros
118
+ // j - Day of the month without leading zeros
119
+ // Y - A full numeric representation of a year, 4 digits
120
+ // example: 3/1/2012 which means 1 March 2012
121
+ ShortDate: "n/j/Y", // in jQuery UI Datepicker: "M/d/yyyy"
122
+ // long date:
123
+ // l - A full textual representation of the day of the week
124
+ // F - A full textual representation of a month
125
+ // d - Day of the month, 2 digits with leading zeros
126
+ // Y - A full numeric representation of a year, 4 digits
127
+ LongDate: "l, F d, Y", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy"
128
+ // long date with long time:
129
+ // l - A full textual representation of the day of the week
130
+ // F - A full textual representation of a month
131
+ // d - Day of the month, 2 digits with leading zeros
132
+ // Y - A full numeric representation of a year, 4 digits
133
+ // g - 12-hour format of an hour without leading zeros
134
+ // i - Minutes with leading zeros
135
+ // s - Seconds, with leading zeros
136
+ // A - Uppercase Ante meridiem and Post meridiem (AM or PM)
137
+ FullDateTime: "l, F d, Y g:i:s A", // in jQuery UI Datepicker: "dddd, MMMM dd, yyyy h:mm:ss tt"
138
+ // month day:
139
+ // F - A full textual representation of a month
140
+ // d - Day of the month, 2 digits with leading zeros
141
+ MonthDay: "F d", // in jQuery UI Datepicker: "MMMM dd"
142
+ // short time (without seconds)
143
+ // g - 12-hour format of an hour without leading zeros
144
+ // i - Minutes with leading zeros
145
+ // A - Uppercase Ante meridiem and Post meridiem (AM or PM)
146
+ ShortTime: "g:i A", // in jQuery UI Datepicker: "h:mm tt"
147
+ // long time (with seconds)
148
+ // g - 12-hour format of an hour without leading zeros
149
+ // i - Minutes with leading zeros
150
+ // s - Seconds, with leading zeros
151
+ // A - Uppercase Ante meridiem and Post meridiem (AM or PM)
152
+ LongTime: "g:i:s A", // in jQuery UI Datepicker: "h:mm:ss tt"
153
+ SortableDateTime: "Y-m-d\\TH:i:s",
154
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
155
+ // month with year
156
+ // Y - A full numeric representation of a year, 4 digits
157
+ // F - A full textual representation of a month
158
+ YearMonth: "F, Y" // in jQuery UI Datepicker: "MMMM, yyyy"
159
+ },
160
+ reformatAfterEdit : false
161
+ },
162
+ baseLinkUrl: '',
163
+ showAction: '',
164
+ target: '',
165
+ checkbox : {disabled:true},
166
+ idName : 'id'
167
+ }
168
+ });
169
+ })(jQuery);
@@ -1,22 +1,23 @@
1
1
  // ==ClosureCompiler==
2
2
  // @compilation_level SIMPLE_OPTIMIZATIONS
3
3
 
4
- /*
5
- * @license jqGrid 4.4.1 - jQuery Grid
4
+ /**
5
+ * @license jqGrid 4.4.2 - 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: 2012-08-28
10
+ * Date: 2013-01-21
11
11
  */
12
12
  //jsHint options
13
- /*global document, window, jQuery, DOMParser, ActiveXObject, $, alert */
13
+ /*jshint evil:true, eqeqeq:false, eqnull:true, devel:true */
14
+ /*global jQuery, DOMParser, ActiveXObject */
14
15
 
15
16
  (function ($) {
16
17
  "use strict";
17
18
  $.jgrid = $.jgrid || {};
18
19
  $.extend($.jgrid,{
19
- version : "4.4.1",
20
+ version : "4.4.2",
20
21
  htmlDecode : function(value){
21
22
  if(value && (value=='&nbsp;' || value=='&#160;' || (value.length===1 && value.charCodeAt(0)===160))) { return "";}
22
23
  return !value ? value : String(value).replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
@@ -26,7 +27,7 @@ $.extend($.jgrid,{
26
27
  },
27
28
  format : function(format){ //jqgformat
28
29
  var args = $.makeArray(arguments).slice(1);
29
- if(format===undefined) { format = ""; }
30
+ if(format==null) { format = ""; }
30
31
  return format.replace(/\{(\d+)\}/g, function(m, i){
31
32
  return args[i];
32
33
  });
@@ -39,14 +40,13 @@ $.extend($.jgrid,{
39
40
  return c.cellIndex;
40
41
  },
41
42
  stripHtml : function(v) {
42
- v = v+"";
43
+ v = String(v);
43
44
  var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
44
45
  if (v) {
45
46
  v = v.replace(regexp,"");
46
47
  return (v && v !== '&nbsp;' && v !== '&#160;') ? v.replace(/\"/g,"'") : "";
47
- } else {
48
+ }
48
49
  return v;
49
- }
50
50
  },
51
51
  stripPref : function (pref, id) {
52
52
  var obj = $.type( pref );
@@ -75,13 +75,13 @@ $.extend($.jgrid,{
75
75
  if (js.substr(0,9) == "while(1);") { js = js.substr(9); }
76
76
  if (js.substr(0,2) == "/*") { js = js.substr(2,js.length-4); }
77
77
  if(!js) { js = "{}"; }
78
- return ($.jgrid.useJSON===true && typeof (JSON) === 'object' && typeof (JSON.parse) === 'function') ?
78
+ return ($.jgrid.useJSON===true && typeof JSON === 'object' && typeof JSON.parse === 'function') ?
79
79
  JSON.parse(js) :
80
80
  eval('(' + js + ')');
81
81
  },
82
82
  parseDate : function(format, date) {
83
83
  var tsp = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0, u:0},k,hl,dM, regdate = /[\\\/:_;.,\t\T\s-]/;
84
- if(date && date !== null && date !== undefined){
84
+ if(date && date != null){
85
85
  date = $.trim(date);
86
86
  date = date.split(regdate);
87
87
  if ($.jgrid.formatter.date.masks[format] !== undefined) {
@@ -146,7 +146,7 @@ $.extend($.jgrid,{
146
146
  guid : 1,
147
147
  uidPref: 'jqg',
148
148
  randId : function( prefix ) {
149
- return (prefix? prefix: $.jgrid.uidPref) + ($.jgrid.guid++);
149
+ return (prefix || $.jgrid.uidPref) + ($.jgrid.guid++);
150
150
  },
151
151
  getAccessor : function(obj, expr) {
152
152
  var ret,p,prm = [], i;
@@ -170,19 +170,18 @@ $.extend($.jgrid,{
170
170
  return ret;
171
171
  },
172
172
  getXmlData: function (obj, expr, returnObj) {
173
- var ret, m = typeof (expr) === 'string' ? expr.match(/^(.*)\[(\w+)\]$/) : null;
174
- if (typeof (expr) === 'function') { return expr(obj); }
173
+ var ret, m = typeof expr === 'string' ? expr.match(/^(.*)\[(\w+)\]$/) : null;
174
+ if (typeof expr === 'function') { return expr(obj); }
175
175
  if (m && m[2]) {
176
176
  // m[2] is the attribute selector
177
177
  // m[1] is an optional element selector
178
178
  // examples: "[id]", "rows[page]"
179
179
  return m[1] ? $(m[1], obj).attr(m[2]) : $(obj).attr(m[2]);
180
- } else {
180
+ }
181
181
  ret = $(expr, obj);
182
182
  if (returnObj) { return ret; }
183
183
  //$(expr, obj).filter(':last'); // we use ':last' to be more compatible with old version of jqGrid
184
184
  return ret.length > 0 ? $(ret).text() : undefined;
185
- }
186
185
  },
187
186
  cellWidth : function () {
188
187
  var $testDiv = $("<div class='ui-jqgrid' style='left:10000px'><table class='ui-jqgrid-btable' style='width:5px;'><tr class='jqgrow'><td style='width:5px;'></td></tr></table></div>"),
@@ -192,12 +191,13 @@ $.extend($.jgrid,{
192
191
  $testDiv.remove();
193
192
  return testCell !== 5;
194
193
  },
194
+ cell_width : true,
195
195
  ajaxOptions: {},
196
196
  from : function(source){
197
197
  // Original Author Hugo Bonacci
198
198
  // License MIT http://jlinq.codeplex.com/license
199
199
  var QueryObject=function(d,q){
200
- if(typeof(d)=="string"){
200
+ if(typeof d==="string"){
201
201
  d=$.data(d);
202
202
  }
203
203
  var self=this,
@@ -213,9 +213,9 @@ $.extend($.jgrid,{
213
213
  _queuedOperator="",
214
214
  _sorting=[],
215
215
  _useProperties=true;
216
- if(typeof(d)=="object"&&d.push) {
216
+ if(typeof d==="object"&&d.push) {
217
217
  if(d.length>0){
218
- if(typeof(d[0])!="object"){
218
+ if(typeof d[0]!=="object"){
219
219
  _useProperties=false;
220
220
  }else{
221
221
  _useProperties=true;
@@ -242,11 +242,10 @@ $.extend($.jgrid,{
242
242
  return phrase.join("");
243
243
  };
244
244
  this._strComp=function(val){
245
- if(typeof(val)=="string"){
245
+ if(typeof val==="string"){
246
246
  return".toString()";
247
- }else{
248
- return"";
249
247
  }
248
+ return"";
250
249
  };
251
250
  this._group=function(f,u){
252
251
  return({field:f.toString(),unique:u,items:[]});
@@ -327,9 +326,9 @@ $.extend($.jgrid,{
327
326
  if (a > b) { return d; }
328
327
  return 0;
329
328
  }
330
- if(!_usecase && typeof(a) !== "number" && typeof(b) !== "number" ) {
331
- a=String(a).toLowerCase();
332
- b=String(b).toLowerCase();
329
+ if(!_usecase && typeof a !== "number" && typeof b !== "number" ) {
330
+ a=String(a);
331
+ b=String(b);
333
332
  }
334
333
  if(a<b){return -d;}
335
334
  if(a>b){return d;}
@@ -348,11 +347,10 @@ $.extend($.jgrid,{
348
347
  return self._getOrder(d, by, dir, type, dfmt);
349
348
  }
350
349
  q++;
351
- var values=self._getGroup(d,by,dir,type,dfmt);
352
- var results=[];
353
- for(var i=0;i<values.length;i++){
354
- var sorted=self._doSort(values[i].items,q);
355
- for(var j=0;j<sorted.length;j++){
350
+ var values=self._getGroup(d,by,dir,type,dfmt), results=[], i, j, sorted;
351
+ for(i=0;i<values.length;i++){
352
+ sorted=self._doSort(values[i].items,q);
353
+ for(j=0;j<sorted.length;j++){
356
354
  results.push(sorted[j]);
357
355
  }
358
356
  }
@@ -380,8 +378,8 @@ $.extend($.jgrid,{
380
378
  findSortKey = type;
381
379
  } else {
382
380
  findSortKey = function($cell) {
383
- if(!$cell) {$cell ="";}
384
- return $.trim(String($cell).toUpperCase());
381
+ $cell = $cell ? $.trim(String($cell)) : "";
382
+ return _usecase ? $cell : $cell.toLowerCase();
385
383
  };
386
384
  }
387
385
  $.each(data,function(i,v){
@@ -412,7 +410,7 @@ $.extend($.jgrid,{
412
410
  last=null, val;
413
411
  $.each(self._getOrder(data,by,dir,type, dfmt),function(i,v){
414
412
  val = $.jgrid.getAccessor(v, by);
415
- if(val === undefined) { val = ""; }
413
+ if(val == null) { val = ""; }
416
414
  if(!self._equals(last,val)){
417
415
  last=val;
418
416
  if(group !== null){
@@ -581,7 +579,7 @@ $.extend($.jgrid,{
581
579
  return self._compareValues(self.lessOrEquals,f,v,"<=",t);
582
580
  };
583
581
  this.startsWith=function(f,v){
584
- var val = (v===undefined || v===null) ? f: v,
582
+ var val = (v==null) ? f: v,
585
583
  length=_trim ? $.trim(val.toString()).length : val.toString().length;
586
584
  if(_useProperties){
587
585
  self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(v)+'"'));
@@ -594,7 +592,7 @@ $.extend($.jgrid,{
594
592
  return self;
595
593
  };
596
594
  this.endsWith=function(f,v){
597
- var val = (v===undefined || v===null) ? f: v,
595
+ var val = (v==null) ? f: v,
598
596
  length=_trim ? $.trim(val.toString()).length:val.toString().length;
599
597
  if(_useProperties){
600
598
  self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.substr('+self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.length-'+length+','+length+') == "'+self._toStr(v)+'"');
@@ -621,9 +619,9 @@ $.extend($.jgrid,{
621
619
  return self._getGroup(_data,by,dir,type, datefmt);
622
620
  };
623
621
  this.orderBy=function(by,dir,stype, dfmt){
624
- dir = dir === undefined || dir === null ? "a" :$.trim(dir.toString().toLowerCase());
625
- if(stype === null || stype === undefined) { stype = "text"; }
626
- if(dfmt === null || dfmt === undefined) { dfmt = "Y-m-d"; }
622
+ dir = dir == null ? "a" :$.trim(dir.toString().toLowerCase());
623
+ if(stype == null) { stype = "text"; }
624
+ if(dfmt == null) { dfmt = "Y-m-d"; }
627
625
  if(dir=="desc"||dir=="descending"){dir="d";}
628
626
  if(dir=="asc"||dir=="ascending"){dir="a";}
629
627
  _sorting.push({by:by,dir:dir,type:stype, datefmt: dfmt});
@@ -633,6 +631,9 @@ $.extend($.jgrid,{
633
631
  };
634
632
  return new QueryObject(source,null);
635
633
  },
634
+ getMethod: function (name) {
635
+ return this.getAccessor($.fn.jqGrid, name);
636
+ },
636
637
  extend : function(methods) {
637
638
  $.extend($.fn.jqGrid,methods);
638
639
  if (!this.no_legacy_api) {
@@ -642,9 +643,8 @@ $.extend($.jgrid,{
642
643
  });
643
644
 
644
645
  $.fn.jqGrid = function( pin ) {
645
- if (typeof pin == 'string') {
646
- //var fn = $.fn.jqGrid[pin];
647
- var fn = $.jgrid.getAccessor($.fn.jqGrid,pin);
646
+ if (typeof pin === 'string') {
647
+ var fn = $.jgrid.getMethod(pin);
648
648
  if (!fn) {
649
649
  throw ("jqGrid - No such method: " + pin);
650
650
  }
@@ -868,7 +868,7 @@ $.fn.jqGrid = function( pin ) {
868
868
  empty = true;
869
869
  }
870
870
  if (npage) {
871
- if (p.lastpage && page > p.lastpage || p.lastpage==1 || (page === p.page && page===p.lastpage) ) {
871
+ if (p.lastpage && (page > p.lastpage || p.lastpage==1 || (page === p.page && page===p.lastpage)) ) {
872
872
  return;
873
873
  }
874
874
  if (grid.hDiv.loading) {
@@ -933,7 +933,7 @@ $.fn.jqGrid = function( pin ) {
933
933
  return;
934
934
  }
935
935
  }
936
- $(this).empty().attr("tabindex","1");
936
+ $(this).empty().attr("tabindex","0");
937
937
  this.p = p ;
938
938
  this.p.useProp = !!$.fn.prop;
939
939
  var i, dir;
@@ -966,8 +966,8 @@ $.fn.jqGrid = function( pin ) {
966
966
  var sortkeys = ["shiftKey","altKey","ctrlKey"],
967
967
  intNum = function(val,defval) {
968
968
  val = parseInt(val,10);
969
- if (isNaN(val)) { return defval ? defval : 0;}
970
- else {return val;}
969
+ if (isNaN(val)) { return defval || 0;}
970
+ return val;
971
971
  },
972
972
  formatCol = function (pos, rowInd, tv, rawObject, rowId, rdata){
973
973
  var cm = ts.p.colModel[pos],
@@ -979,7 +979,7 @@ $.fn.jqGrid = function( pin ) {
979
979
  } else if (cm.cellattr && $.isFunction(cm.cellattr))
980
980
  {
981
981
  celp = cm.cellattr.call(ts, rowId, tv, rawObject, cm, rdata);
982
- if(celp && typeof(celp) === "string") {
982
+ if(celp && typeof celp === "string") {
983
983
  celp = celp.replace(/style/i,'style').replace(/title/i,'title');
984
984
  if(celp.indexOf('title') > -1) { cm.title=false;}
985
985
  if(celp.indexOf('class') > -1) { clas = undefined;}
@@ -1001,11 +1001,12 @@ $.fn.jqGrid = function( pin ) {
1001
1001
  return result + acp[0];
1002
1002
  },
1003
1003
  cellVal = function (val) {
1004
- return val === undefined || val === null || val === "" ? "&#160;" : (ts.p.autoencode ? $.jgrid.htmlEncode(val) : val+"");
1004
+ return val == null || val === "" ? "&#160;" : (ts.p.autoencode ? $.jgrid.htmlEncode(val) : String(val));
1005
1005
  },
1006
1006
  formatter = function (rowId, cellval , colpos, rwdat, _act){
1007
1007
  var cm = ts.p.colModel[colpos],v;
1008
- if(typeof cm.formatter !== 'undefined') {
1008
+ if(cm.formatter !== undefined) {
1009
+ rowId = String(ts.p.idPrefix) !== "" ? $.jgrid.stripPref(ts.p.idPrefix, rowId) : rowId;
1009
1010
  var opts= {rowId: rowId, colModel:cm, gid:ts.p.id, pos:colpos };
1010
1011
  if($.isFunction( cm.formatter ) ) {
1011
1012
  v = cm.formatter.call(ts,cellval,opts,rwdat,_act);
@@ -1019,14 +1020,14 @@ $.fn.jqGrid = function( pin ) {
1019
1020
  }
1020
1021
  return v;
1021
1022
  },
1022
- addCell = function(rowId,cell,pos,irow, srvr) {
1023
+ addCell = function(rowId,cell,pos,irow, srvr, rdata) {
1023
1024
  var v,prp;
1024
1025
  v = formatter(rowId,cell,pos,srvr,'add');
1025
- prp = formatCol( pos,irow, v, srvr, rowId, true);
1026
+ prp = formatCol( pos,irow, v, srvr, rowId, rdata);
1026
1027
  return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
1027
1028
  },
1028
1029
  addMulti = function(rowid,pos,irow,checked){
1029
- var v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+ts.p.id+"_"+rowid+"\" class=\"cbox\" name=\"jqg_"+ts.p.id+"_"+rowid+"\"" + ((checked) ? "checked=\"checked\"" : "")+"/>",
1030
+ var v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+ts.p.id+"_"+rowid+"\" class=\"cbox\" name=\"jqg_"+ts.p.id+"_"+rowid+"\"" + (checked ? "checked=\"checked\"" : "")+"/>",
1030
1031
  prp = formatCol( pos,irow,'',null, rowid, true);
1031
1032
  return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
1032
1033
  },
@@ -1090,12 +1091,13 @@ $.fn.jqGrid = function( pin ) {
1090
1091
  }
1091
1092
  for(i =0;i < datalen; i++) {
1092
1093
  val = $.jgrid.getAccessor(ts.p.data[i],idname);
1094
+ if (val === undefined) { val=String(i+1); }
1093
1095
  ts.p._index[val] = i;
1094
1096
  }
1095
1097
  },
1096
1098
  constructTr = function(id, hide, altClass, rd, cur, selected) {
1097
1099
  var tabindex = '-1', restAttr = '', attrName, style = hide ? 'display:none;' : '',
1098
- classes = 'ui-widget-content jqgrow ui-row-' + ts.p.direction + altClass + ((selected) ? ' ui-state-highlight' : ''),
1100
+ classes = 'ui-widget-content jqgrow ui-row-' + ts.p.direction + altClass + (selected ? ' ui-state-highlight' : ''),
1099
1101
  rowAttrObj = $.isFunction(ts.p.rowattr) ? ts.p.rowattr.call(ts, rd, cur) : {};
1100
1102
  if(!$.isEmptyObject( rowAttrObj )) {
1101
1103
  if (rowAttrObj.hasOwnProperty("id")) {
@@ -1142,7 +1144,11 @@ $.fn.jqGrid = function( pin ) {
1142
1144
  rcnt=1;
1143
1145
  } else { rcnt = rcnt > 1 ? rcnt :1; }
1144
1146
  } else { return; }
1145
- var i,fpos,ir=0,v,gi=ts.p.multiselect===true?1:0,si=ts.p.subGrid===true?1:0,ni=ts.p.rownumbers===true?1:0,idn, getId,f=[],F,rd ={}, xmlr,rid, rowData=[], cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1;
1147
+ var self= $(ts), i,fpos,ir=0,v,gi=ts.p.multiselect===true?1:0,si=0,addSubGridCell,ni=ts.p.rownumbers===true?1:0,idn, getId,f=[],F,rd ={}, xmlr,rid, rowData=[], cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1;
1148
+ if(ts.p.subGrid===true) {
1149
+ si = 1;
1150
+ addSubGridCell = $.jgrid.getMethod("addSubGridCell");
1151
+ }
1146
1152
  if(!xmlRd.repeatitems) {f = reader(frd);}
1147
1153
  if( ts.p.keyIndex===false) {
1148
1154
  idn = $.isFunction( xmlRd.id ) ? xmlRd.id.call(ts, xml) : xmlRd.id;
@@ -1155,7 +1161,7 @@ $.fn.jqGrid = function( pin ) {
1155
1161
  }
1156
1162
  idn=f[idn];
1157
1163
  }
1158
- if( (idn+"").indexOf("[") === -1 ) {
1164
+ if( String(idn).indexOf("[") === -1 ) {
1159
1165
  if (f.length) {
1160
1166
  getId = function( trow, k) {return $(idn,trow).text() || k;};
1161
1167
  } else {
@@ -1178,12 +1184,15 @@ $.fn.jqGrid = function( pin ) {
1178
1184
  var gxml = $.jgrid.getXmlData( xml, xmlRd.root, true);
1179
1185
  gxml = $.jgrid.getXmlData( gxml, xmlRd.row, true);
1180
1186
  if (!gxml) { gxml = []; }
1181
- var gl = gxml.length, j=0, grpdata=[], rn = parseInt(ts.p.rowNum,10);
1187
+ var gl = gxml.length, j=0, grpdata=[], rn = parseInt(ts.p.rowNum,10), br=ts.p.scroll?$.jgrid.randId():1, altr;
1182
1188
  if (gl > 0 && ts.p.page <= 0) { ts.p.page = 1; }
1183
1189
  if(gxml && gl){
1184
- var br=ts.p.scroll?$.jgrid.randId():1,altr;
1185
1190
  if (adjust) { rn *= adjust+1; }
1186
- var afterInsRow = $.isFunction(ts.p.afterInsertRow), hiderow=ts.p.grouping && ts.p.groupingView.groupCollapse === true;
1191
+ var afterInsRow = $.isFunction(ts.p.afterInsertRow), hiderow=false, groupingPrepare;
1192
+ if(ts.p.grouping) {
1193
+ hiderow = ts.p.groupingView.groupCollapse === true;
1194
+ groupingPrepare = $.jgrid.getMethod("groupingPrepare");
1195
+ }
1187
1196
  while (j<gl) {
1188
1197
  xmlr = gxml[j];
1189
1198
  rid = getId(xmlr,br+j);
@@ -1199,7 +1208,7 @@ $.fn.jqGrid = function( pin ) {
1199
1208
  rowData.push( addMulti(rid,ni,j, false) );
1200
1209
  }
1201
1210
  if( si ) {
1202
- rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,j+rcnt) );
1211
+ rowData.push( addSubGridCell.call(self,gi+ni,j+rcnt) );
1203
1212
  }
1204
1213
  if(xmlRd.repeatitems){
1205
1214
  if (!F) { F=orderedCols(gi+si+ni); }
@@ -1209,19 +1218,19 @@ $.fn.jqGrid = function( pin ) {
1209
1218
  if (!cell) { return false; }
1210
1219
  v = cell.textContent || cell.text;
1211
1220
  rd[ts.p.colModel[k+gi+si+ni].name] = v;
1212
- rowData.push( addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr) );
1221
+ rowData.push( addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr, rd) );
1213
1222
  });
1214
1223
  } else {
1215
1224
  for(i = 0; i < f.length;i++) {
1216
1225
  v = $.jgrid.getXmlData( xmlr, f[i]);
1217
1226
  rd[ts.p.colModel[i+gi+si+ni].name] = v;
1218
- rowData.push( addCell(rid, v, i+gi+si+ni, j+rcnt, xmlr) );
1227
+ rowData.push( addCell(rid, v, i+gi+si+ni, j+rcnt, xmlr, rd) );
1219
1228
  }
1220
1229
  }
1221
1230
  rowData[iStartTrTag] = constructTr(rid, hiderow, cn1, rd, xmlr, false);
1222
1231
  rowData.push("</tr>");
1223
1232
  if(ts.p.grouping) {
1224
- grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpdata, rd, j);
1233
+ grpdata = groupingPrepare.call(self,rowData, grpdata, rd, j);
1225
1234
  rowData = [];
1226
1235
  }
1227
1236
  if(locdata || ts.p.treeGrid === true) {
@@ -1231,7 +1240,7 @@ $.fn.jqGrid = function( pin ) {
1231
1240
  }
1232
1241
  if(ts.p.gridview === false ) {
1233
1242
  $("tbody:first",t).append(rowData.join(''));
1234
- $(ts).triggerHandler("jqGridAfterInsertRow", [rid, rd, xmlr]);
1243
+ self.triggerHandler("jqGridAfterInsertRow", [rid, rd, xmlr]);
1235
1244
  if(afterInsRow) {ts.p.afterInsertRow.call(ts,rid,rd,xmlr);}
1236
1245
  rowData=[];
1237
1246
  }
@@ -1244,7 +1253,7 @@ $.fn.jqGrid = function( pin ) {
1244
1253
  if(ts.p.gridview === true) {
1245
1254
  fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
1246
1255
  if(ts.p.grouping) {
1247
- $(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
1256
+ self.jqGrid('groupingRender',grpdata,ts.p.colModel.length);
1248
1257
  grpdata = null;
1249
1258
  } else if(ts.p.treeGrid === true && fpos > 0) {
1250
1259
  $(ts.rows[fpos]).after(rowData.join(''));
@@ -1253,18 +1262,18 @@ $.fn.jqGrid = function( pin ) {
1253
1262
  }
1254
1263
  }
1255
1264
  if(ts.p.subGrid === true ) {
1256
- try {$(ts).jqGrid("addSubGrid",gi+ni);} catch (_){}
1265
+ try {self.jqGrid("addSubGrid",gi+ni);} catch (_){}
1257
1266
  }
1258
1267
  ts.p.totaltime = new Date() - startReq;
1259
1268
  if(ir>0) { if(ts.p.records===0) { ts.p.records=gl;} }
1260
1269
  rowData =null;
1261
1270
  if( ts.p.treeGrid === true) {
1262
- try {$(ts).jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {}
1271
+ try {self.jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {}
1263
1272
  }
1264
1273
  if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
1265
1274
  ts.p.reccount=ir;
1266
1275
  ts.p.treeANode = -1;
1267
- if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
1276
+ if(ts.p.userDataOnFooter) { self.jqGrid("footerData","set",ts.p.userData,true); }
1268
1277
  if(locdata) {
1269
1278
  ts.p.records = gl;
1270
1279
  ts.p.lastpage = Math.ceil(gl/ rn);
@@ -1318,9 +1327,13 @@ $.fn.jqGrid = function( pin ) {
1318
1327
  dReader = ts.p.jsonReader;
1319
1328
  frd='json';
1320
1329
  }
1321
- var ir=0,v,i,j,f=[],F,cur,gi=ts.p.multiselect?1:0,si=ts.p.subGrid?1:0,ni=ts.p.rownumbers===true?1:0,len,drows,idn,rd={}, fpos, idr,rowData=[],cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1,lp;
1330
+ var self = $(ts), ir=0,v,i,j,f=[],F,cur,gi=ts.p.multiselect?1:0,si=0,addSubGridCell,ni=ts.p.rownumbers===true?1:0,len,drows,idn,rd={}, fpos, idr,rowData=[],cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1,lp;
1322
1331
  ts.p.page = $.jgrid.getAccessor(data,dReader.page) || ts.p.page || 0;
1323
1332
  lp = $.jgrid.getAccessor(data,dReader.total);
1333
+ if(ts.p.subGrid===true) {
1334
+ si = 1;
1335
+ addSubGridCell = $.jgrid.getMethod("addSubGridCell");
1336
+ }
1324
1337
  ts.p.lastpage = lp === undefined ? 1 : lp;
1325
1338
  ts.p.records = $.jgrid.getAccessor(data,dReader.records) || 0;
1326
1339
  ts.p.userData = $.jgrid.getAccessor(data,dReader.userdata) || {};
@@ -1347,7 +1360,11 @@ $.fn.jqGrid = function( pin ) {
1347
1360
  if(ts.p.datatype === "local" && !ts.p.deselectAfterSort) {
1348
1361
  selected = true;
1349
1362
  }
1350
- var afterInsRow = $.isFunction(ts.p.afterInsertRow), grpdata=[], hiderow=ts.p.grouping && ts.p.groupingView.groupCollapse === true;
1363
+ var afterInsRow = $.isFunction(ts.p.afterInsertRow), grpdata=[],hiderow=false, groupingPrepare;
1364
+ if(ts.p.grouping) {
1365
+ hiderow = ts.p.groupingView.groupCollapse === true;
1366
+ groupingPrepare = $.jgrid.getMethod("groupingPrepare");
1367
+ }
1351
1368
  while (i<len) {
1352
1369
  cur = drows[i];
1353
1370
  idr = $.jgrid.getAccessor(cur,idn);
@@ -1380,7 +1397,7 @@ $.fn.jqGrid = function( pin ) {
1380
1397
  rowData.push( addMulti(idr,ni,i,selr) );
1381
1398
  }
1382
1399
  if( si ) {
1383
- rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,i+rcnt) );
1400
+ rowData.push( addSubGridCell.call(self,gi+ni,i+rcnt) );
1384
1401
  }
1385
1402
  if (dReader.repeatitems) {
1386
1403
  if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);}
@@ -1388,13 +1405,13 @@ $.fn.jqGrid = function( pin ) {
1388
1405
  }
1389
1406
  for (j=0;j<F.length;j++) {
1390
1407
  v = $.jgrid.getAccessor(cur,F[j]);
1391
- rowData.push( addCell(idr,v,j+gi+si+ni,i+rcnt,cur) );
1392
1408
  rd[ts.p.colModel[j+gi+si+ni].name] = v;
1409
+ rowData.push( addCell(idr,v,j+gi+si+ni,i+rcnt,cur, rd) );
1393
1410
  }
1394
1411
  rowData[iStartTrTag] = constructTr(idr, hiderow, cn1, rd, cur, selr);
1395
1412
  rowData.push( "</tr>" );
1396
1413
  if(ts.p.grouping) {
1397
- grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpdata, rd, i);
1414
+ grpdata = groupingPrepare.call(self,rowData, grpdata, rd, i);
1398
1415
  rowData = [];
1399
1416
  }
1400
1417
  if(locdata || ts.p.treeGrid===true) {
@@ -1404,7 +1421,7 @@ $.fn.jqGrid = function( pin ) {
1404
1421
  }
1405
1422
  if(ts.p.gridview === false ) {
1406
1423
  $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").append(rowData.join(''));
1407
- $(ts).triggerHandler("jqGridAfterInsertRow", [idr, rd, cur]);
1424
+ self.triggerHandler("jqGridAfterInsertRow", [idr, rd, cur]);
1408
1425
  if(afterInsRow) {ts.p.afterInsertRow.call(ts,idr,rd,cur);}
1409
1426
  rowData=[];//ari=0;
1410
1427
  }
@@ -1416,7 +1433,7 @@ $.fn.jqGrid = function( pin ) {
1416
1433
  if(ts.p.gridview === true ) {
1417
1434
  fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
1418
1435
  if(ts.p.grouping) {
1419
- $(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
1436
+ self.jqGrid('groupingRender',grpdata,ts.p.colModel.length);
1420
1437
  grpdata = null;
1421
1438
  } else if(ts.p.treeGrid === true && fpos > 0) {
1422
1439
  $(ts.rows[fpos]).after(rowData.join(''));
@@ -1425,7 +1442,7 @@ $.fn.jqGrid = function( pin ) {
1425
1442
  }
1426
1443
  }
1427
1444
  if(ts.p.subGrid === true ) {
1428
- try { $(ts).jqGrid("addSubGrid",gi+ni);} catch (_){}
1445
+ try { self.jqGrid("addSubGrid",gi+ni);} catch (_){}
1429
1446
  }
1430
1447
  ts.p.totaltime = new Date() - startReq;
1431
1448
  if(ir>0) {
@@ -1433,12 +1450,12 @@ $.fn.jqGrid = function( pin ) {
1433
1450
  }
1434
1451
  rowData = null;
1435
1452
  if( ts.p.treeGrid === true) {
1436
- try {$(ts).jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {}
1453
+ try {self.jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {}
1437
1454
  }
1438
1455
  if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
1439
1456
  ts.p.reccount=ir;
1440
1457
  ts.p.treeANode = -1;
1441
- if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
1458
+ if(ts.p.userDataOnFooter) { self.jqGrid("footerData","set",ts.p.userData,true); }
1442
1459
  if(locdata) {
1443
1460
  ts.p.records = len;
1444
1461
  ts.p.lastpage = Math.ceil(len/ rn);
@@ -1487,7 +1504,7 @@ $.fn.jqGrid = function( pin ) {
1487
1504
  $.each(ts.p.colModel,function(){
1488
1505
  sorttype = this.sorttype || "text";
1489
1506
  if(sorttype == "date" || sorttype == "datetime") {
1490
- if(this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date') {
1507
+ if(this.formatter && typeof this.formatter === 'string' && this.formatter == 'date') {
1491
1508
  if(this.formatoptions && this.formatoptions.srcformat) {
1492
1509
  srcformat = this.formatoptions.srcformat;
1493
1510
  } else {
@@ -1509,7 +1526,7 @@ $.fn.jqGrid = function( pin ) {
1509
1526
  for(gin =0, lengrp = grpview.groupField.length; gin< lengrp; gin++) {
1510
1527
  if( this.name == grpview.groupField[gin]) {
1511
1528
  var grindex = this.name;
1512
- if (typeof this.index != 'undefined') {
1529
+ if (this.index) {
1513
1530
  grindex = this.index;
1514
1531
  }
1515
1532
  grtypes[gin] = cmtypes[grindex];
@@ -1549,7 +1566,7 @@ $.fn.jqGrid = function( pin ) {
1549
1566
  if (ts.p.ignoreCase) { query = query.ignoreCase(); }
1550
1567
  function tojLinq ( group ) {
1551
1568
  var s = 0, index, gor, ror, opr, rule;
1552
- if (group.groups !== undefined) {
1569
+ if (group.groups != null) {
1553
1570
  gor = group.groups.length && group.groupOp.toString().toUpperCase() === "OR";
1554
1571
  if (gor) {
1555
1572
  query.orBegin();
@@ -1567,7 +1584,7 @@ $.fn.jqGrid = function( pin ) {
1567
1584
  query.orEnd();
1568
1585
  }
1569
1586
  }
1570
- if (group.rules !== undefined) {
1587
+ if (group.rules != null) {
1571
1588
  if(s>0) {
1572
1589
  var result = query.select();
1573
1590
  query = $.jgrid.from( result);
@@ -1599,7 +1616,7 @@ $.fn.jqGrid = function( pin ) {
1599
1616
  if (ts.p.search === true) {
1600
1617
  var srules = ts.p.postData.filters;
1601
1618
  if(srules) {
1602
- if(typeof srules == "string") { srules = $.jgrid.parse(srules);}
1619
+ if(typeof srules === "string") { srules = $.jgrid.parse(srules);}
1603
1620
  tojLinq( srules );
1604
1621
  } else {
1605
1622
  try {
@@ -1656,7 +1673,7 @@ $.fn.jqGrid = function( pin ) {
1656
1673
  }
1657
1674
  ts.grid.bDiv.scrollLeft = ts.grid.hDiv.scrollLeft;
1658
1675
  }
1659
- pgboxes = ts.p.pager ? ts.p.pager : "";
1676
+ pgboxes = ts.p.pager || "";
1660
1677
  pgboxes += ts.p.toppager ? (pgboxes ? "," + ts.p.toppager : ts.p.toppager) : "";
1661
1678
  if(pgboxes) {
1662
1679
  fmt = $.jgrid.formatter.integer || {};
@@ -1789,7 +1806,7 @@ $.fn.jqGrid = function( pin ) {
1789
1806
  var bfr = $(ts).triggerHandler("jqGridBeforeRequest");
1790
1807
  if (bfr === false || bfr === 'stop') { return; }
1791
1808
  if ($.isFunction(ts.p.datatype)) { ts.p.datatype.call(ts,ts.p.postData,"load_"+ts.p.id); return;}
1792
- else if($.isFunction(ts.p.beforeRequest)) {
1809
+ if ($.isFunction(ts.p.beforeRequest)) {
1793
1810
  bfr = ts.p.beforeRequest.call(ts);
1794
1811
  if(bfr === undefined) { bfr = true; }
1795
1812
  if ( bfr === false ) { return; }
@@ -1836,10 +1853,9 @@ $.fn.jqGrid = function( pin ) {
1836
1853
  if(gotoreq === undefined) { gotoreq = true; }
1837
1854
  if(gotoreq === false) {
1838
1855
  return false;
1839
- } else {
1856
+ }
1840
1857
  beginReq();
1841
1858
  }
1842
- }
1843
1859
  },$.jgrid.ajaxOptions, ts.p.ajaxGridOptions));
1844
1860
  break;
1845
1861
  case "xmlstring":
@@ -1855,7 +1871,7 @@ $.fn.jqGrid = function( pin ) {
1855
1871
  break;
1856
1872
  case "jsonstring":
1857
1873
  beginReq();
1858
- if(typeof ts.p.datastr == 'string') { dstr = $.jgrid.parse(ts.p.datastr); }
1874
+ if(typeof ts.p.datastr === 'string') { dstr = $.jgrid.parse(ts.p.datastr); }
1859
1875
  else { dstr = ts.p.datastr; }
1860
1876
  addJSONData(dstr,ts.grid.bDiv);
1861
1877
  $(ts).triggerHandler("jqGridLoadComplete", [dstr]);
@@ -1944,11 +1960,11 @@ $.fn.jqGrid = function( pin ) {
1944
1960
  ts.p._nvtd[1] = 0;
1945
1961
  pgl=null;
1946
1962
  $('.ui-pg-selbox',"#"+pgcnt).bind('change',function() {
1963
+ if(!clearVals('records')) { return false; }
1947
1964
  ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;
1948
1965
  ts.p.rowNum = this.value;
1949
1966
  if(ts.p.pager) { $('.ui-pg-selbox',ts.p.pager).val(this.value); }
1950
1967
  if(ts.p.toppager) { $('.ui-pg-selbox',ts.p.toppager).val(this.value); }
1951
- if(!clearVals('records')) { return false; }
1952
1968
  populate();
1953
1969
  return false;
1954
1970
  });
@@ -1976,12 +1992,12 @@ $.fn.jqGrid = function( pin ) {
1976
1992
  //else if( cp>1 && cp <last){ }
1977
1993
  else if( cp===last){ np=false;lp=false; }
1978
1994
  } else if( last>1 && cp===0 ) { np=false;lp=false; cp=last-1;}
1995
+ if(!clearVals(this.id)) { return false; }
1979
1996
  if( this.id === 'first'+tp && fp ) { ts.p.page=1; selclick=true;}
1980
1997
  if( this.id === 'prev'+tp && pp) { ts.p.page=(cp-1); selclick=true;}
1981
1998
  if( this.id === 'next'+tp && np) { ts.p.page=(cp+1); selclick=true;}
1982
1999
  if( this.id === 'last'+tp && lp) { ts.p.page=last; selclick=true;}
1983
2000
  if(selclick) {
1984
- if(!clearVals(this.id)) { return false; }
1985
2001
  populate();
1986
2002
  }
1987
2003
  return false;
@@ -1989,10 +2005,10 @@ $.fn.jqGrid = function( pin ) {
1989
2005
  }
1990
2006
  if(ts.p.pginput===true) {
1991
2007
  $('input.ui-pg-input',"#"+pgcnt).keypress( function(e) {
1992
- var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
2008
+ var key = e.charCode || e.keyCode || 0;
1993
2009
  if(key == 13) {
1994
- ts.p.page = ($(this).val()>0) ? $(this).val():ts.p.page;
1995
2010
  if(!clearVals('user')) { return false; }
2011
+ ts.p.page = ($(this).val()>0) ? $(this).val():ts.p.page;
1996
2012
  populate();
1997
2013
  return false;
1998
2014
  }
@@ -2014,7 +2030,7 @@ $.fn.jqGrid = function( pin ) {
2014
2030
  }
2015
2031
  if(sor) {
2016
2032
  if(ts.p.lastsort == idxcol && ts.p.sortorder == sor && !reload) { return; }
2017
- else { ts.p.sortorder = sor; }
2033
+ ts.p.sortorder = sor;
2018
2034
  }
2019
2035
  var previousSelectedTh = ts.grid.headers[ts.p.lastsort].el, newSelectedTh = ts.grid.headers[idxcol].el;
2020
2036
 
@@ -2059,10 +2075,16 @@ $.fn.jqGrid = function( pin ) {
2059
2075
  if(ts.p.sortname != index && idxcol) {ts.p.lastsort = idxcol;}
2060
2076
  },
2061
2077
  setColWidth = function () {
2062
- var initwidth = 0, brd=$.jgrid.cellWidth()? 0: intNum(ts.p.cellLayout,0), vc=0, lvc, scw=intNum(ts.p.scrollOffset,0),cw,hs=false,aw,gw=0,
2078
+ var initwidth = 0, brd=$.jgrid.cell_width? 0: intNum(ts.p.cellLayout,0), vc=0, lvc, scw=intNum(ts.p.scrollOffset,0),cw,hs=false,aw,gw=0,
2063
2079
  cl = 0, cr;
2064
2080
  $.each(ts.p.colModel, function() {
2065
- if(typeof this.hidden === 'undefined') {this.hidden=false;}
2081
+ if(this.hidden === undefined) {this.hidden=false;}
2082
+ if(ts.p.grouping && ts.p.autowidth) {
2083
+ var ind = $.inArray(this.name, ts.p.groupingView.groupField);
2084
+ if(ind !== -1) {
2085
+ this.hidden = !ts.p.groupingView.groupColumnShow[ind];
2086
+ }
2087
+ }
2066
2088
  this.widthOrg = cw = intNum(this.width,0);
2067
2089
  if(this.hidden===false){
2068
2090
  initwidth += cw+brd;
@@ -2121,7 +2143,7 @@ $.fn.jqGrid = function( pin ) {
2121
2143
  return j-ret;
2122
2144
  },
2123
2145
  getOffset = function (iCol) {
2124
- var i, ret = {}, brd1 = $.jgrid.cellWidth() ? 0 : ts.p.cellLayout;
2146
+ var i, ret = {}, brd1 = $.jgrid.cell_width ? 0 : ts.p.cellLayout;
2125
2147
  ret[0] = ret[1] = ret[2] = 0;
2126
2148
  for(i=0;i<=iCol;i++){
2127
2149
  if(ts.p.colModel[i].hidden === false ) {
@@ -2156,6 +2178,7 @@ $.fn.jqGrid = function( pin ) {
2156
2178
  }
2157
2179
  }
2158
2180
  ts.p.sortorder = ts.p.sortorder.toLowerCase();
2181
+ $.jgrid.cell_width = $.jgrid.cellWidth();
2159
2182
  if(ts.p.grouping===true) {
2160
2183
  ts.p.scroll = false;
2161
2184
  ts.p.rownumbers = false;
@@ -2172,7 +2195,7 @@ $.fn.jqGrid = function( pin ) {
2172
2195
  }
2173
2196
  if(this.p.multiselect) {
2174
2197
  this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");
2175
- this.p.colModel.unshift({name:'cb',width:$.jgrid.cellWidth() ? ts.p.multiselectWidth+ts.p.cellLayout : ts.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
2198
+ this.p.colModel.unshift({name:'cb',width:$.jgrid.cell_width ? ts.p.multiselectWidth+ts.p.cellLayout : ts.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
2176
2199
  }
2177
2200
  if(this.p.rownumbers) {
2178
2201
  this.p.colNames.unshift("");
@@ -2238,7 +2261,7 @@ $.fn.jqGrid = function( pin ) {
2238
2261
  thead += "<div id='jqgh_"+ts.p.id+"_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i];
2239
2262
  if(!ts.p.colModel[i].width) { ts.p.colModel[i].width = 150; }
2240
2263
  else { ts.p.colModel[i].width = parseInt(ts.p.colModel[i].width,10); }
2241
- if(typeof(ts.p.colModel[i].title) !== "boolean") { ts.p.colModel[i].title = true; }
2264
+ if(typeof ts.p.colModel[i].title !== "boolean") { ts.p.colModel[i].title = true; }
2242
2265
  if (idn == ts.p.sortname) {
2243
2266
  ts.p.lastsort = i;
2244
2267
  }
@@ -2308,7 +2331,7 @@ $.fn.jqGrid = function( pin ) {
2308
2331
  ts.p.disableClick=false;
2309
2332
  $("th",thr).each(function ( j ) {
2310
2333
  w = ts.p.colModel[j].width;
2311
- if(typeof ts.p.colModel[j].resizable === 'undefined') {ts.p.colModel[j].resizable = true;}
2334
+ if(ts.p.colModel[j].resizable === undefined) {ts.p.colModel[j].resizable = true;}
2312
2335
  if(ts.p.colModel[j].resizable){
2313
2336
  res = document.createElement("span");
2314
2337
  $(res).html("&#160;").addClass('ui-jqgrid-resize ui-jqgrid-resize-'+dir);
@@ -2383,7 +2406,7 @@ $.fn.jqGrid = function( pin ) {
2383
2406
  if(hg) { $(grid.hDiv).hide(); }
2384
2407
  if(ts.p.pager){
2385
2408
  // TBD -- escape ts.p.pager here?
2386
- if(typeof ts.p.pager == "string") {if(ts.p.pager.substr(0,1) !="#") { ts.p.pager = "#"+ts.p.pager;} }
2409
+ if(typeof ts.p.pager === "string") {if(ts.p.pager.substr(0,1) !="#") { ts.p.pager = "#"+ts.p.pager;} }
2387
2410
  else { ts.p.pager = "#"+ $(ts.p.pager).attr("id");}
2388
2411
  $(ts.p.pager).css({width: grid.width+"px"}).appendTo(eg).addClass('ui-state-default ui-jqgrid-pager ui-corner-bottom');
2389
2412
  if(hg) {$(ts.p.pager).hide();}
@@ -2635,11 +2658,11 @@ $.jgrid.extend({
2635
2658
  var $t = this[0];
2636
2659
  if (!$t || !$t.grid) {return;}
2637
2660
  if (!pName) { return $t.p; }
2638
- else {return typeof($t.p[pName]) != "undefined" ? $t.p[pName] : null;}
2661
+ return $t.p[pName] !== undefined ? $t.p[pName] : null;
2639
2662
  },
2640
2663
  setGridParam : function (newParams){
2641
2664
  return this.each(function(){
2642
- if (this.grid && typeof(newParams) === 'object') {$.extend(true,this.p,newParams);}
2665
+ if (this.grid && typeof newParams === 'object') {$.extend(true,this.p,newParams);}
2643
2666
  });
2644
2667
  },
2645
2668
  getDataIDs : function () {
@@ -2663,7 +2686,7 @@ $.jgrid.extend({
2663
2686
  var $t = this, stat,pt, ner, ia, tpsr, fid;
2664
2687
  if(selection === undefined) { return; }
2665
2688
  onsr = onsr === false ? false : true;
2666
- pt=$t.rows.namedItem(selection+"");
2689
+ pt=$t.rows.namedItem(String(selection));
2667
2690
  if(!pt || !pt.className || pt.className.indexOf( 'ui-state-disabled' ) > -1 ) { return; }
2668
2691
  function scrGrid(iR){
2669
2692
  var ch = $($t.grid.bDiv)[0].clientHeight,
@@ -2739,7 +2762,7 @@ $.jgrid.extend({
2739
2762
  if( t.p.frozenColumns === true ) {
2740
2763
  fid = t.p.id+"_frozen";
2741
2764
  }
2742
- if(typeof(rowid) !== "undefined" ) {
2765
+ if(rowid !== undefined ) {
2743
2766
  sr = rowid === t.p.selrow ? t.p.selrow : rowid;
2744
2767
  $("#"+$.jgrid.jqID(t.p.id)+" tbody:first tr#"+$.jgrid.jqID(sr)).removeClass("ui-state-highlight").attr("aria-selected","false");
2745
2768
  if (fid) { $("#"+$.jgrid.jqID(sr), "#"+$.jgrid.jqID(fid)).removeClass("ui-state-highlight"); }
@@ -2781,7 +2804,7 @@ $.jgrid.extend({
2781
2804
  var res = {}, resall, getall=false, len, j=0;
2782
2805
  this.each(function(){
2783
2806
  var $t = this,nm,ind;
2784
- if(typeof(rowid) == 'undefined') {
2807
+ if(rowid === undefined) {
2785
2808
  getall = true;
2786
2809
  resall = [];
2787
2810
  len = $t.rows.length;
@@ -2812,7 +2835,7 @@ $.jgrid.extend({
2812
2835
  j++;
2813
2836
  }
2814
2837
  });
2815
- return resall ? resall: res;
2838
+ return resall || res;
2816
2839
  },
2817
2840
  delRowData : function(rowid) {
2818
2841
  var success = false, rowInd, ia, ri;
@@ -2820,7 +2843,6 @@ $.jgrid.extend({
2820
2843
  var $t = this;
2821
2844
  rowInd = $t.rows.namedItem(rowid);
2822
2845
  if(!rowInd) {return false;}
2823
- else {
2824
2846
  ri = rowInd.rowIndex;
2825
2847
  $(rowInd).remove();
2826
2848
  $t.p.records--;
@@ -2831,12 +2853,15 @@ $.jgrid.extend({
2831
2853
  ia = $.inArray(rowid,$t.p.selarrrow);
2832
2854
  if(ia != -1) { $t.p.selarrrow.splice(ia,1);}
2833
2855
  }
2834
- if(rowid == $t.p.selrow) {$t.p.selrow=null;}
2835
- }
2856
+ if ($t.p.multiselect && $t.p.selarrrow.length > 0) {
2857
+ $t.p.selrow = $t.p.selarrrow[$t.p.selarrrow.length-1];
2858
+ } else {
2859
+ $t.p.selrow = null;
2860
+ }
2836
2861
  if($t.p.datatype == 'local') {
2837
2862
  var id = $.jgrid.stripPref($t.p.idPrefix, rowid),
2838
2863
  pos = $t.p._index[id];
2839
- if(typeof(pos) != 'undefined') {
2864
+ if(pos !== undefined) {
2840
2865
  $t.p.data.splice(pos,1);
2841
2866
  $t.refreshIndex();
2842
2867
  }
@@ -2863,27 +2888,27 @@ $.jgrid.extend({
2863
2888
  $(this.p.colModel).each(function(i){
2864
2889
  nm = this.name;
2865
2890
  if( data[nm] !== undefined) {
2866
- lcdata[nm] = this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date' ? $.unformat.date.call(t,data[nm],this) : data[nm];
2891
+ lcdata[nm] = this.formatter && typeof this.formatter === 'string' && this.formatter == 'date' ? $.unformat.date.call(t,data[nm],this) : data[nm];
2867
2892
  vl = t.formatter( rowid, data[nm], i, data, 'edit');
2868
2893
  title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
2869
2894
  if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
2870
- $("td:eq("+i+") > span:first",ind).html(vl).attr(title);
2895
+ $("td[role='gridcell']:eq("+i+") > span:first",ind).html(vl).attr(title);
2871
2896
  } else {
2872
- $("td:eq("+i+")",ind).html(vl).attr(title);
2897
+ $("td[role='gridcell']:eq("+i+")",ind).html(vl).attr(title);
2873
2898
  }
2874
2899
  }
2875
2900
  });
2876
2901
  if(t.p.datatype == 'local') {
2877
2902
  var id = $.jgrid.stripPref(t.p.idPrefix, rowid),
2878
- pos = t.p._index[id];
2903
+ pos = t.p._index[id], key;
2879
2904
  if(t.p.treeGrid) {
2880
- for(var key in t.p.treeReader ){
2881
- if(lcdata.hasOwnProperty(t.p.treeReader[key])) {
2905
+ for(key in t.p.treeReader){
2906
+ if(t.p.treeReader.hasOwnProperty(key)) {
2882
2907
  delete lcdata[t.p.treeReader[key]];
2883
2908
  }
2884
2909
  }
2885
2910
  }
2886
- if(typeof(pos) != 'undefined') {
2911
+ if(pos !== undefined) {
2887
2912
  t.p.data[pos] = $.extend(true, t.p.data[pos], lcdata);
2888
2913
  }
2889
2914
  lcdata = null;
@@ -2917,12 +2942,12 @@ $.jgrid.extend({
2917
2942
  gi = t.p.multiselect ===true ? 1 :0;
2918
2943
  si = t.p.subGrid===true ? 1 :0;
2919
2944
  if(!aradd) {
2920
- if(typeof(rowid) != 'undefined') { rowid = rowid+"";}
2945
+ if(rowid !== undefined) { rowid = String(rowid);}
2921
2946
  else {
2922
2947
  rowid = $.jgrid.randId();
2923
2948
  if(t.p.keyIndex !== false) {
2924
2949
  cnm = t.p.colModel[t.p.keyIndex+gi+si+ni].name;
2925
- if(typeof rdata[0][cnm] != "undefined") { rowid = rdata[0][cnm]; }
2950
+ if(rdata[0][cnm] !== undefined) { rowid = rdata[0][cnm]; }
2926
2951
  }
2927
2952
  }
2928
2953
  }
@@ -2933,7 +2958,12 @@ $.jgrid.extend({
2933
2958
  data = rdata[k];
2934
2959
  row=[];
2935
2960
  if(aradd) {
2936
- try {rowid = data[cnm];}
2961
+ try {
2962
+ rowid = data[cnm];
2963
+ if(rowid===undefined) {
2964
+ rowid = $.jgrid.randId();
2965
+ }
2966
+ }
2937
2967
  catch (e) {rowid = $.jgrid.randId();}
2938
2968
  cna = t.p.altRows === true ? (t.rows.length-1)%2 === 0 ? cn : "" : "";
2939
2969
  }
@@ -2956,7 +2986,7 @@ $.jgrid.extend({
2956
2986
  nm = cm.name;
2957
2987
  lcdata[nm] = data[nm];
2958
2988
  v = t.formatter( rowid, $.jgrid.getAccessor(data,nm), i, data );
2959
- prp = t.formatCol(i,1,v, data, rowid, true);
2989
+ prp = t.formatCol(i,1,v, data, rowid, lcdata);
2960
2990
  row[row.length] = "<td role=\"gridcell\" "+prp+">"+v+"</td>";
2961
2991
  }
2962
2992
  row.unshift( t.constructTr(rowid, false, cna, lcdata, data, false ) );
@@ -3022,13 +3052,14 @@ $.jgrid.extend({
3022
3052
  footerData : function(action,data, format) {
3023
3053
  var nm, success=false, res={}, title;
3024
3054
  function isEmpty(obj) {
3025
- for(var i in obj) {
3055
+ var i;
3056
+ for(i in obj) {
3026
3057
  if (obj.hasOwnProperty(i)) { return false; }
3027
3058
  }
3028
3059
  return true;
3029
3060
  }
3030
- if(typeof(action) == "undefined") { action = "get"; }
3031
- if(typeof(format) != "boolean") { format = true; }
3061
+ if(action === undefined) { action = "get"; }
3062
+ if(typeof format !== "boolean") { format = true; }
3032
3063
  action = action.toLowerCase();
3033
3064
  this.each(function(){
3034
3065
  var t = this, vl;
@@ -3053,7 +3084,7 @@ $.jgrid.extend({
3053
3084
  },
3054
3085
  showHideCol : function(colname,show) {
3055
3086
  return this.each(function() {
3056
- var $t = this, fndh=false, brd=$.jgrid.cellWidth()? 0: $t.p.cellLayout, cw;
3087
+ var $t = this, fndh=false, brd=$.jgrid.cell_width ? 0: $t.p.cellLayout, cw;
3057
3088
  if (!$t.grid ) {return;}
3058
3089
  if( typeof colname === 'string') {colname=[colname];}
3059
3090
  show = show != "none" ? "" : "none";
@@ -3151,9 +3182,9 @@ $.jgrid.extend({
3151
3182
  return this.each(function(){
3152
3183
  if (!this.grid ) {return;}
3153
3184
  var $t = this, cw,
3154
- initwidth = 0, brd=$.jgrid.cellWidth() ? 0: $t.p.cellLayout, lvc, vc=0, hs=false, scw=$t.p.scrollOffset, aw, gw=0,
3185
+ initwidth = 0, brd=$.jgrid.cell_width ? 0: $t.p.cellLayout, lvc, vc=0, hs=false, scw=$t.p.scrollOffset, aw, gw=0,
3155
3186
  cl = 0,cr;
3156
- if(typeof shrink != 'boolean') {
3187
+ if(typeof shrink !== 'boolean') {
3157
3188
  shrink=$t.p.shrinkToFit;
3158
3189
  }
3159
3190
  if(isNaN(nwidth)) {return;}
@@ -3271,7 +3302,7 @@ $.jgrid.extend({
3271
3302
  return this.each(function(){
3272
3303
  var $t = this, pos=-1;
3273
3304
  if(!$t.grid) {return;}
3274
- if(typeof(colname) != "undefined") {
3305
+ if(colname !== undefined) {
3275
3306
  $($t.p.colModel).each(function(i){
3276
3307
  if (this.name == colname) {
3277
3308
  pos = i;return false;
@@ -3317,9 +3348,9 @@ $.jgrid.extend({
3317
3348
  }
3318
3349
  if($t.p.datatype == "local") {
3319
3350
  var cm = $t.p.colModel[pos], index;
3320
- nData = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date.call($t,nData,cm) : nData;
3351
+ nData = cm.formatter && typeof cm.formatter === 'string' && cm.formatter == 'date' ? $.unformat.date.call($t,nData,cm) : nData;
3321
3352
  index = $t.p._index[rowid];
3322
- if(typeof index != "undefined") {
3353
+ if(index !== undefined) {
3323
3354
  $t.p.data[index][cm.name] = nData;
3324
3355
  }
3325
3356
  }
@@ -3361,8 +3392,8 @@ $.jgrid.extend({
3361
3392
  },
3362
3393
  getCol : function (col, obj, mathopr) {
3363
3394
  var ret = [], val, sum=0, min, max, v;
3364
- obj = typeof (obj) != 'boolean' ? false : obj;
3365
- if(typeof mathopr == 'undefined') { mathopr = false; }
3395
+ obj = typeof obj !== 'boolean' ? false : obj;
3396
+ if(mathopr === undefined) { mathopr = false; }
3366
3397
  this.each(function(){
3367
3398
  var $t=this, pos=-1;
3368
3399
  if(!$t.grid) {return;}
@@ -3386,7 +3417,7 @@ $.jgrid.extend({
3386
3417
  if(mathopr) {
3387
3418
  v = parseFloat(val);
3388
3419
  sum += v;
3389
- if (max === undefined) {max = min = v}
3420
+ if (max === undefined) {max = min = v;}
3390
3421
  min = Math.min(min, v);
3391
3422
  max = Math.max(max, v);
3392
3423
  }
@@ -3413,7 +3444,7 @@ $.jgrid.extend({
3413
3444
  return this.each(function(){
3414
3445
  var $t = this;
3415
3446
  if(!$t.grid) {return;}
3416
- if(typeof clearfooter != 'boolean') { clearfooter = false; }
3447
+ if(typeof clearfooter !== 'boolean') { clearfooter = false; }
3417
3448
  if($t.p.deepempty) {$("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:gt(0)").remove();}
3418
3449
  else {
3419
3450
  var trf = $("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:first")[0];
@@ -3534,7 +3565,7 @@ $.jgrid.extend({
3534
3565
  getLocalRow : function (rowid) {
3535
3566
  var ret = false, ind;
3536
3567
  this.each(function(){
3537
- if(typeof(rowid) !== "undefined") {
3568
+ if(rowid !== undefined) {
3538
3569
  ind = this.p._index[rowid];
3539
3570
  if(ind >= 0 ) {
3540
3571
  ret = this.p.data[ind];
@@ -3545,7 +3576,9 @@ $.jgrid.extend({
3545
3576
  }
3546
3577
  });
3547
3578
  })(jQuery);
3548
- ;(function($){
3579
+ /*jshint eqeqeq:false */
3580
+ /*global jQuery */
3581
+ (function($){
3549
3582
  /*
3550
3583
  **
3551
3584
  * jqGrid extension for cellediting Grid Data
@@ -3628,6 +3661,7 @@ $.jgrid.extend({
3628
3661
  $t.p.beforeEditCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol);
3629
3662
  }
3630
3663
  $(cc).html("").append(elc).attr("tabindex","0");
3664
+ $.jgrid.bindEv( elc, opt, $t);
3631
3665
  window.setTimeout(function () { $(elc).focus();},0);
3632
3666
  $("input, select, textarea",cc).bind("keydown",function(e) {
3633
3667
  if (e.keyCode === 27) {
@@ -3721,9 +3755,9 @@ $.jgrid.extend({
3721
3755
  if (v===undefined) { throw "e2";} else { v2=v; }
3722
3756
  } else { throw "e1"; }
3723
3757
  } catch (e) {
3724
- if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
3725
- if (e=="e2") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
3726
- else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
3758
+ if (e=="e1") { $.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,$.jgrid.edit.bClose); }
3759
+ if (e=="e2") { $.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose); }
3760
+ else {$.jgrid.info_dialog($.jgrid.errors.errcap,e.message,$.jgrid.edit.bClose); }
3727
3761
  }
3728
3762
  break;
3729
3763
  }
@@ -3859,10 +3893,10 @@ $.jgrid.extend({
3859
3893
  },
3860
3894
  nextCell : function (iRow,iCol) {
3861
3895
  return this.each(function (){
3862
- var $t = this, nCol=false;
3896
+ var $t = this, nCol=false, i;
3863
3897
  if (!$t.grid || $t.p.cellEdit !== true) {return;}
3864
3898
  // try to find next editable cell
3865
- for (var i=iCol+1; i<$t.p.colModel.length; i++) {
3899
+ for (i=iCol+1; i<$t.p.colModel.length; i++) {
3866
3900
  if ( $t.p.colModel[i].editable ===true) {
3867
3901
  nCol = i; break;
3868
3902
  }
@@ -3878,10 +3912,10 @@ $.jgrid.extend({
3878
3912
  },
3879
3913
  prevCell : function (iRow,iCol) {
3880
3914
  return this.each(function (){
3881
- var $t = this, nCol=false;
3915
+ var $t = this, nCol=false, i;
3882
3916
  if (!$t.grid || $t.p.cellEdit !== true) {return;}
3883
3917
  // try to find next editable cell
3884
- for (var i=iCol-1; i>=0; i--) {
3918
+ for (i=iCol-1; i>=0; i--) {
3885
3919
  if ( $t.p.colModel[i].editable ===true) {
3886
3920
  nCol = i; break;
3887
3921
  }
@@ -3901,7 +3935,7 @@ $.jgrid.extend({
3901
3935
  if (!$t.grid || $t.p.cellEdit !== true ) {return;}
3902
3936
  // trick to process keydown on non input elements
3903
3937
  $t.p.knv = $t.p.id + "_kn";
3904
- var selection = $("<div style='position:absolute;top:-1000000px;width:1px;height:1px;' tabindex='0'><div tabindex='-1' style='width:1px;height:1px;' id='"+$t.p.knv+"'></div></div>"),
3938
+ var selection = $("<div style='position:fixed;top:-1000000px;width:1px;height:1px;' tabindex='0'><div tabindex='-1' style='width:1px;height:1px;' id='"+$t.p.knv+"'></div></div>"),
3905
3939
  i, kdir;
3906
3940
  function scrollGrid(iR, iC, tp){
3907
3941
  if (tp.substr(0,1)=='v') {
@@ -4042,7 +4076,9 @@ $.jgrid.extend({
4042
4076
  /// end cell editing
4043
4077
  });
4044
4078
  })(jQuery);
4045
- ;(function($){
4079
+ /*jshint eqeqeq:false */
4080
+ /*global jQuery */
4081
+ (function($){
4046
4082
  /*
4047
4083
  * jqGrid common function
4048
4084
  * Tony Tomov tony@trirand.com
@@ -4051,8 +4087,7 @@ $.jgrid.extend({
4051
4087
  * http://www.opensource.org/licenses/mit-license.php
4052
4088
  * http://www.gnu.org/licenses/gpl-2.0.html
4053
4089
  */
4054
- /*global jQuery, $ */
4055
-
4090
+ "use strict";
4056
4091
  $.extend($.jgrid,{
4057
4092
  // Modal functions
4058
4093
  showModal : function(h) {
@@ -4065,8 +4100,8 @@ $.extend($.jgrid,{
4065
4100
  hideModal : function (selector,o) {
4066
4101
  o = $.extend({jqm : true, gb :''}, o || {});
4067
4102
  if(o.onClose) {
4068
- var oncret = o.onClose(selector);
4069
- if (typeof oncret == 'boolean' && !oncret ) { return; }
4103
+ var oncret = o.gb && typeof o.gb === "string" && o.gb.substr(0,6) === "#gbox_" ? o.onClose.call($("#" + o.gb.substr(6))[0], selector) : o.onClose(selector);
4104
+ if (typeof oncret === 'boolean' && !oncret ) { return; }
4070
4105
  }
4071
4106
  if ($.fn.jqm && o.jqm === true) {
4072
4107
  $(selector).attr("aria-hidden","true").jqmHide();
@@ -4090,7 +4125,7 @@ $.extend($.jgrid,{
4090
4125
  return [curleft,curtop];
4091
4126
  },
4092
4127
  createModal : function(aIDs, content, p, insertSelector, posSelector, appendsel, css) {
4093
- p = $.extend(true, $.jgrid.jqModal || {}, p);
4128
+ p = $.extend(true, {}, $.jgrid.jqModal || {}, p);
4094
4129
  var mw = document.createElement('div'), rtlsup, self = this;
4095
4130
  css = $.extend({}, css || {});
4096
4131
  rtlsup = $(p.gbox).attr("dir") == "rtl" ? true : false;
@@ -4102,7 +4137,7 @@ $.extend($.jgrid,{
4102
4137
  $(mh).append("<span class='ui-jqdialog-title'>"+p.caption+"</span>");
4103
4138
  var ahr= $("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>")
4104
4139
  .hover(function(){ahr.addClass('ui-state-hover');},
4105
- function(){ahr.removeClass('ui-state-hover');})
4140
+ function(){ahr.removeClass('ui-state-hover');})
4106
4141
  .append("<span class='ui-icon ui-icon-closethick'></span>");
4107
4142
  $(mh).append(ahr);
4108
4143
  if(rtlsup) {
@@ -4120,11 +4155,11 @@ $.extend($.jgrid,{
4120
4155
  mw.appendChild(mc);
4121
4156
  $(mw).prepend(mh);
4122
4157
  if(appendsel===true) { $('body').append(mw); } //append as first child in body -for alert dialog
4123
- else if (typeof appendsel == "string")
4158
+ else if (typeof appendsel === "string") {
4124
4159
  $(appendsel).append(mw);
4125
- else {$(mw).insertBefore(insertSelector);}
4160
+ } else {$(mw).insertBefore(insertSelector);}
4126
4161
  $(mw).css(css);
4127
- if(typeof p.jqModal === 'undefined') {p.jqModal = true;} // internal use
4162
+ if(p.jqModal === undefined) {p.jqModal = true;} // internal use
4128
4163
  var coord = {};
4129
4164
  if ( $.fn.jqm && p.jqModal === true) {
4130
4165
  if(p.left ===0 && p.top===0 && p.overlay) {
@@ -4169,8 +4204,8 @@ $.extend($.jgrid,{
4169
4204
  overflow: 'hidden'
4170
4205
  },coord))
4171
4206
  .attr({tabIndex: "-1","role":"dialog","aria-labelledby":aIDs.modalhead,"aria-hidden":"true"});
4172
- if(typeof p.drag == 'undefined') { p.drag=true;}
4173
- if(typeof p.resize == 'undefined') {p.resize=true;}
4207
+ if(p.drag === undefined) { p.drag=true;}
4208
+ if(p.resize === undefined) {p.resize=true;}
4174
4209
  if (p.drag) {
4175
4210
  $(mh).css('cursor','move');
4176
4211
  if($.fn.jqDrag) {
@@ -4183,7 +4218,7 @@ $.extend($.jgrid,{
4183
4218
  }
4184
4219
  if(p.resize) {
4185
4220
  if($.fn.jqResize) {
4186
- $(mw).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");
4221
+ $(mw).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se'></div>");
4187
4222
  $("#"+$.jgrid.jqID(aIDs.themodal)).jqResize(".jqResize",aIDs.scrollelm ? "#"+$.jgrid.jqID(aIDs.scrollelm) : false);
4188
4223
  } else {
4189
4224
  try {
@@ -4195,7 +4230,7 @@ $.extend($.jgrid,{
4195
4230
  $(mw).keydown( function( e ) {
4196
4231
  if( e.which == 27 ) {
4197
4232
  var cone = $("#"+$.jgrid.jqID(aIDs.themodal)).data("onClose") || p.onClose;
4198
- self.hideModal(this,{gb:p.gbox,jqm:p.jqModal,onClose: cone});
4233
+ self.hideModal("#"+$.jgrid.jqID(aIDs.themodal),{gb:p.gbox,jqm:p.jqModal,onClose: cone});
4199
4234
  }
4200
4235
  });
4201
4236
  }
@@ -4224,7 +4259,6 @@ $.extend($.jgrid,{
4224
4259
  try{$(':input:visible',selector)[0].focus();}catch(_){}
4225
4260
  }
4226
4261
  },
4227
-
4228
4262
  info_dialog : function(caption, content,c_b, modalopt) {
4229
4263
  var mopt = {
4230
4264
  width:290,
@@ -4232,7 +4266,6 @@ $.extend($.jgrid,{
4232
4266
  dataheight: 'auto',
4233
4267
  drag: true,
4234
4268
  resize: false,
4235
- caption:"<b>"+caption+"</b>",
4236
4269
  left:250,
4237
4270
  top:170,
4238
4271
  zIndex : 1000,
@@ -4245,14 +4278,14 @@ $.extend($.jgrid,{
4245
4278
  // {text:'textbutt', id:"buttid", onClick : function(){...}}
4246
4279
  // if the id is not provided we set it like info_button_+ the index in the array - i.e info_button_0,info_button_1...
4247
4280
  };
4248
- $.extend(mopt,modalopt || {});
4281
+ $.extend(true, mopt, $.jgrid.jqModal || {}, {caption:"<b>"+caption+"</b>"}, modalopt || {});
4249
4282
  var jm = mopt.jqModal, self = this;
4250
4283
  if($.fn.jqm && !jm) { jm = false; }
4251
4284
  // in case there is no jqModal
4252
- var buttstr ="";
4285
+ var buttstr ="", i;
4253
4286
  if(mopt.buttons.length > 0) {
4254
- for(var i=0;i<mopt.buttons.length;i++) {
4255
- if(typeof mopt.buttons[i].id == "undefined") { mopt.buttons[i].id = "info_button_"+i; }
4287
+ for(i=0;i<mopt.buttons.length;i++) {
4288
+ if(mopt.buttons[i].id === undefined) { mopt.buttons[i].id = "info_button_"+i; }
4256
4289
  buttstr += "<a href='javascript:void(0)' id='"+mopt.buttons[i].id+"' class='fm-button ui-state-default ui-corner-all'>"+mopt.buttons[i].text+"</a>";
4257
4290
  }
4258
4291
  }
@@ -4305,27 +4338,26 @@ $.extend($.jgrid,{
4305
4338
  if($.isFunction(mopt.afterOpen) ) { mopt.afterOpen(); }
4306
4339
  try{ $("#info_dialog").focus();} catch (m){}
4307
4340
  },
4341
+ bindEv: function (el, opt, $t) {
4342
+ if($.isFunction(opt.dataInit)) {
4343
+ opt.dataInit.call($t,el);
4344
+ }
4345
+ if(opt.dataEvents) {
4346
+ $.each(opt.dataEvents, function() {
4347
+ if (this.data !== undefined) {
4348
+ $(el).bind(this.type, this.data, this.fn);
4349
+ } else {
4350
+ $(el).bind(this.type, this.fn);
4351
+ }
4352
+ });
4353
+ }
4354
+ },
4308
4355
  // Form Functions
4309
4356
  createEl : function(eltype,options,vl,autowidth, ajaxso) {
4310
4357
  var elem = "", $t = this;
4311
- function bindEv (el, opt) {
4312
- if($.isFunction(opt.dataInit)) {
4313
- opt.dataInit.call($t,el);
4314
- }
4315
- if(opt.dataEvents) {
4316
- $.each(opt.dataEvents, function() {
4317
- if (this.data !== undefined) {
4318
- $(el).bind(this.type, this.data, this.fn);
4319
- } else {
4320
- $(el).bind(this.type, this.fn);
4321
- }
4322
- });
4323
- }
4324
- return opt;
4325
- }
4326
4358
  function setAttributes(elm, atr, exl ) {
4327
- var exclude = ['dataInit','dataEvents','dataUrl', 'buildSelect','sopt', 'searchhidden', 'defaultValue', 'attr'];
4328
- if(typeof(exl) != "undefined" && $.isArray(exl)) {
4359
+ var exclude = ['dataInit','dataEvents','dataUrl', 'buildSelect','sopt', 'searchhidden', 'defaultValue', 'attr', 'custom_element', 'custom_value'];
4360
+ if(exl !== undefined && $.isArray(exl)) {
4329
4361
  $.merge(exclude, exl);
4330
4362
  }
4331
4363
  $.each(atr, function(key, value){
@@ -4348,7 +4380,6 @@ $.extend($.jgrid,{
4348
4380
  if(vl=='&nbsp;' || vl=='&#160;' || (vl.length==1 && vl.charCodeAt(0)==160)) {vl="";}
4349
4381
  elem.value = vl;
4350
4382
  setAttributes(elem, options);
4351
- options = bindEv(elem,options);
4352
4383
  $(elem).attr({"role":"textbox","multiline":"true"});
4353
4384
  break;
4354
4385
  case "checkbox" : //what code for simple checkbox
@@ -4374,7 +4405,6 @@ $.extend($.jgrid,{
4374
4405
  $(elem).attr("offval",cbval[1]);
4375
4406
  }
4376
4407
  setAttributes(elem, options, ['value']);
4377
- options = bindEv(elem,options);
4378
4408
  $(elem).attr("role","checkbox");
4379
4409
  break;
4380
4410
  case "select" :
@@ -4386,11 +4416,20 @@ $.extend($.jgrid,{
4386
4416
  elem.multiple="multiple";
4387
4417
  $(elem).attr("aria-multiselectable","true");
4388
4418
  } else { msl = false; }
4389
- if(typeof(options.dataUrl) != "undefined") {
4419
+ if(options.dataUrl !== undefined) {
4420
+ var rowid = options.name ? String(options.id).substring(0, String(options.id).length - String(options.name).length - 1) : String(options.id),
4421
+ postData = options.postData || ajaxso.postData;
4422
+
4423
+ if ($t.p && $t.p.idPrefix) {
4424
+ rowid = $.jgrid.stripPref($t.p.idPrefix, rowid);
4425
+ } else {
4426
+ postData = undefined; // don't use postData for searching from jqFilter. One can implement the feature in the future if required.
4427
+ }
4390
4428
  $.ajax($.extend({
4391
4429
  url: options.dataUrl,
4392
4430
  type : "GET",
4393
4431
  dataType: "html",
4432
+ data: $.isFunction(postData) ? postData.call($t, rowid, vl, String(options.name)) : postData,
4394
4433
  context: {elem:elem, options:options, vl:vl},
4395
4434
  success: function(data){
4396
4435
  var a, ovm = [], elem = this.elem, vl = this.vl,
@@ -4405,8 +4444,7 @@ $.extend($.jgrid,{
4405
4444
  if(a) {
4406
4445
  $(elem).append(a);
4407
4446
  setAttributes(elem, options);
4408
- options = bindEv(elem,options);
4409
- if(typeof options.size === 'undefined') { options.size = msl ? 3 : 1;}
4447
+ if(options.size === undefined) { options.size = msl ? 3 : 1;}
4410
4448
  if(msl) {
4411
4449
  ovm = vl.split(",");
4412
4450
  ovm = $.map(ovm,function(n){return $.trim(n);});
@@ -4430,7 +4468,7 @@ $.extend($.jgrid,{
4430
4468
  },ajaxso || {}));
4431
4469
  } else if(options.value) {
4432
4470
  var i;
4433
- if(typeof options.size === 'undefined') {
4471
+ if(options.size === undefined) {
4434
4472
  options.size = msl ? 3 : 1;
4435
4473
  }
4436
4474
  if(msl) {
@@ -4456,8 +4494,8 @@ $.extend($.jgrid,{
4456
4494
  if (msl && ($.inArray($.trim(sv[1]), ovm)>-1 || $.inArray($.trim(sv[0]), ovm)>-1)) {ov.selected ="selected";}
4457
4495
  }
4458
4496
  } else if (typeof options.value === 'object') {
4459
- var oSv = options.value;
4460
- for ( var key in oSv) {
4497
+ var oSv = options.value, key;
4498
+ for (key in oSv) {
4461
4499
  if (oSv.hasOwnProperty(key ) ){
4462
4500
  ov = document.createElement("option");
4463
4501
  ov.setAttribute("role","option");
@@ -4469,7 +4507,6 @@ $.extend($.jgrid,{
4469
4507
  }
4470
4508
  }
4471
4509
  setAttributes(elem, options, ['value']);
4472
- options = bindEv(elem,options);
4473
4510
  }
4474
4511
  break;
4475
4512
  case "text" :
@@ -4482,7 +4519,6 @@ $.extend($.jgrid,{
4482
4519
  elem.type = eltype;
4483
4520
  elem.value = vl;
4484
4521
  setAttributes(elem, options);
4485
- options = bindEv(elem,options);
4486
4522
  if(eltype != "button"){
4487
4523
  if(autowidth) {
4488
4524
  if(!options.size) { $(elem).css({width:"98%"}); }
@@ -4495,7 +4531,6 @@ $.extend($.jgrid,{
4495
4531
  elem = document.createElement("input");
4496
4532
  elem.type = eltype;
4497
4533
  setAttributes(elem, options);
4498
- options = bindEv(elem,options);
4499
4534
  break;
4500
4535
  case "custom" :
4501
4536
  elem = document.createElement("span");
@@ -4514,7 +4549,7 @@ $.extend($.jgrid,{
4514
4549
  } catch (e) {
4515
4550
  if (e=="e1") { $.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.nodefined, $.jgrid.edit.bClose);}
4516
4551
  if (e=="e2") { $.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose);}
4517
- else { $.jgrid.info_dialog($.jgrid.errors.errcap,typeof(e)==="string"?e:e.message,$.jgrid.edit.bClose); }
4552
+ else { $.jgrid.info_dialog($.jgrid.errors.errcap,typeof e==="string"?e:e.message,$.jgrid.edit.bClose); }
4518
4553
  }
4519
4554
  break;
4520
4555
  }
@@ -4527,8 +4562,9 @@ $.extend($.jgrid,{
4527
4562
  // EXCEPT for centurial years which are not also divisible by 400.
4528
4563
  return (((year % 4 === 0) && ( year % 100 !== 0 || (year % 400 === 0))) ? 29 : 28 );
4529
4564
  },
4530
- DaysArray = function(n) {
4531
- for (var i = 1; i <= n; i++) {
4565
+ daysArray = function(n) {
4566
+ var i;
4567
+ for (i = 1; i <= n; i++) {
4532
4568
  this[i] = 31;
4533
4569
  if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
4534
4570
  if (i==2) {this[i] = 29;}
@@ -4551,8 +4587,8 @@ $.extend($.jgrid,{
4551
4587
  format = format.split(sep);
4552
4588
  date = date.split(sep);
4553
4589
  if (date.length != 3) { return false; }
4554
- var j=-1,yln, dln=-1, mln=-1;
4555
- for(var i=0;i<format.length;i++){
4590
+ var j=-1,yln, dln=-1, mln=-1, i;
4591
+ for(i=0;i<format.length;i++){
4556
4592
  var dv = isNaN(date[i]) ? 0 : parseInt(date[i],10);
4557
4593
  tsp[format[i]] = dv;
4558
4594
  yln = format[i];
@@ -4567,42 +4603,38 @@ $.extend($.jgrid,{
4567
4603
  } else {
4568
4604
  yln = -1;
4569
4605
  }
4570
- var daysInMonth = DaysArray(12),
4606
+ var daysInMonth = daysArray(12),
4571
4607
  strDate;
4572
4608
  if (j === -1) {
4573
4609
  return false;
4574
- } else {
4610
+ }
4575
4611
  strDate = tsp[format[j]].toString();
4576
4612
  if(yln == 2 && strDate.length == 1) {yln = 1;}
4577
4613
  if (strDate.length != yln || (tsp[format[j]]===0 && date[j]!="00")){
4578
4614
  return false;
4579
4615
  }
4580
- }
4581
4616
  if(mln === -1) {
4582
4617
  return false;
4583
- } else {
4618
+ }
4584
4619
  strDate = tsp[format[mln]].toString();
4585
4620
  if (strDate.length<1 || tsp[format[mln]]<1 || tsp[format[mln]]>12){
4586
4621
  return false;
4587
4622
  }
4588
- }
4589
4623
  if(dln === -1) {
4590
4624
  return false;
4591
- } else {
4625
+ }
4592
4626
  strDate = tsp[format[dln]].toString();
4593
4627
  if (strDate.length<1 || tsp[format[dln]]<1 || tsp[format[dln]]>31 || (tsp[format[mln]]==2 && tsp[format[dln]]>daysInFebruary(tsp[format[j]])) || tsp[format[dln]] > daysInMonth[tsp[format[mln]]]){
4594
4628
  return false;
4595
4629
  }
4596
- }
4597
4630
  return true;
4598
4631
  },
4599
4632
  isEmpty : function(val)
4600
4633
  {
4601
4634
  if (val.match(/^\s+$/) || val === "") {
4602
4635
  return true;
4603
- } else {
4604
- return false;
4605
4636
  }
4637
+ return false;
4606
4638
  },
4607
4639
  checkTime : function(time){
4608
4640
  // checks only hh:ss (and optional am/pm)
@@ -4627,8 +4659,8 @@ $.extend($.jgrid,{
4627
4659
  },
4628
4660
  checkValues : function(val, valref,g, customobject, nam) {
4629
4661
  var edtrul,i, nm, dft, len;
4630
- if(typeof(customobject) === "undefined") {
4631
- if(typeof(valref)=='string'){
4662
+ if(customobject === undefined) {
4663
+ if(typeof valref==='string'){
4632
4664
  for( i =0, len=g.p.colModel.length;i<len; i++){
4633
4665
  if(g.p.colModel[i].name==valref) {
4634
4666
  edtrul = g.p.colModel[i].editrules;
@@ -4656,10 +4688,10 @@ $.extend($.jgrid,{
4656
4688
  if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.number,""]; }
4657
4689
  }
4658
4690
  }
4659
- if(typeof edtrul.minValue != 'undefined' && !isNaN(edtrul.minValue)) {
4691
+ if(edtrul.minValue !== undefined && !isNaN(edtrul.minValue)) {
4660
4692
  if (parseFloat(val) < parseFloat(edtrul.minValue) ) { return [false,nm+": "+$.jgrid.edit.msg.minValue+" "+edtrul.minValue,""];}
4661
4693
  }
4662
- if(typeof edtrul.maxValue != 'undefined' && !isNaN(edtrul.maxValue)) {
4694
+ if(edtrul.maxValue !== undefined && !isNaN(edtrul.maxValue)) {
4663
4695
  if (parseFloat(val) > parseFloat(edtrul.maxValue) ) { return [false,nm+": "+$.jgrid.edit.msg.maxValue+" "+edtrul.maxValue,""];}
4664
4696
  }
4665
4697
  var filter;
@@ -4701,21 +4733,19 @@ $.extend($.jgrid,{
4701
4733
  if( !(rqfield === false && $.jgrid.isEmpty(val)) ) {
4702
4734
  if($.isFunction(edtrul.custom_func)) {
4703
4735
  var ret = edtrul.custom_func.call(g,val,nm);
4704
- if($.isArray(ret)) {
4705
- return ret;
4706
- } else {
4707
- return [false,$.jgrid.edit.msg.customarray,""];
4708
- }
4709
- } else {
4710
- return [false,$.jgrid.edit.msg.customfcheck,""];
4736
+ return $.isArray(ret) ? ret : [false,$.jgrid.edit.msg.customarray,""];
4711
4737
  }
4738
+ return [false,$.jgrid.edit.msg.customfcheck,""];
4712
4739
  }
4713
4740
  }
4714
4741
  }
4715
4742
  return [true,"",""];
4716
4743
  }
4717
4744
  });
4718
- })(jQuery);(function($){
4745
+ })(jQuery);
4746
+ /*jshint eqeqeq:false */
4747
+ /*global jQuery */
4748
+ (function($){
4719
4749
  /**
4720
4750
  * jqGrid extension for custom methods
4721
4751
  * Tony Tomov tony@trirand.com
@@ -4727,14 +4757,13 @@ $.extend($.jgrid,{
4727
4757
  * http://www.opensource.org/licenses/mit-license.php
4728
4758
  * http://www.gnu.org/licenses/gpl-2.0.html
4729
4759
  **/
4730
- /*global jQuery, $ */
4731
4760
  "use strict";
4732
4761
  $.jgrid.extend({
4733
4762
  getColProp : function(colname){
4734
4763
  var ret ={}, $t = this[0];
4735
4764
  if ( !$t.grid ) { return false; }
4736
- var cM = $t.p.colModel;
4737
- for ( var i =0;i<cM.length;i++ ) {
4765
+ var cM = $t.p.colModel, i;
4766
+ for ( i=0;i<cM.length;i++ ) {
4738
4767
  if ( cM[i].name == colname ) {
4739
4768
  ret = cM[i];
4740
4769
  break;
@@ -4747,10 +4776,10 @@ $.jgrid.extend({
4747
4776
  return this.each(function(){
4748
4777
  if ( this.grid ) {
4749
4778
  if ( obj ) {
4750
- var cM = this.p.colModel;
4751
- for ( var i =0;i<cM.length;i++ ) {
4779
+ var cM = this.p.colModel, i;
4780
+ for ( i=0;i<cM.length;i++ ) {
4752
4781
  if ( cM[i].name == colname ) {
4753
- $.extend(this.p.colModel[i],obj);
4782
+ $.extend(true, this.p.colModel[i],obj);
4754
4783
  break;
4755
4784
  }
4756
4785
  }
@@ -4760,10 +4789,10 @@ $.jgrid.extend({
4760
4789
  },
4761
4790
  sortGrid : function(colname,reload, sor){
4762
4791
  return this.each(function(){
4763
- var $t=this,idx=-1;
4792
+ var $t=this,idx=-1,i;
4764
4793
  if ( !$t.grid ) { return;}
4765
4794
  if ( !colname ) { colname = $t.p.sortname; }
4766
- for ( var i=0;i<$t.p.colModel.length;i++ ) {
4795
+ for ( i=0;i<$t.p.colModel.length;i++ ) {
4767
4796
  if ( $t.p.colModel[i].index == colname || $t.p.colModel[i].name==colname ) {
4768
4797
  idx = i;
4769
4798
  break;
@@ -4850,7 +4879,7 @@ $.jgrid.extend({
4850
4879
  $("#gbox_"+gid).remove();
4851
4880
  });
4852
4881
  },
4853
- setGridState : function(state) {
4882
+ setGridState : function(state) {
4854
4883
  return this.each(function(){
4855
4884
  if ( !this.grid ) {return;}
4856
4885
  var $t = this;
@@ -4950,7 +4979,7 @@ $.jgrid.extend({
4950
4979
  };
4951
4980
  var clearToolbar = function(trigger){
4952
4981
  var sdata={}, j=0, nm;
4953
- trigger = (typeof trigger != 'boolean') ? true : trigger;
4982
+ trigger = (typeof trigger !== 'boolean') ? true : trigger;
4954
4983
  $.each($t.p.colModel,function(){
4955
4984
  var v;
4956
4985
  if(this.searchoptions && this.searchoptions.defaultValue !== undefined) { v = this.searchoptions.defaultValue; }
@@ -5039,27 +5068,15 @@ $.jgrid.extend({
5039
5068
  }
5040
5069
  };
5041
5070
  // create the row
5042
- function bindEvents(selector, events) {
5043
- var jElem = $(selector);
5044
- if (jElem[0]) {
5045
- jQuery.each(events, function() {
5046
- if (this.data !== undefined) {
5047
- jElem.bind(this.type, this.data, this.fn);
5048
- } else {
5049
- jElem.bind(this.type, this.fn);
5050
- }
5051
- });
5052
- }
5053
- }
5054
5071
  var tr = $("<tr class='ui-search-toolbar' role='rowheader'></tr>");
5055
5072
  var timeoutHnd;
5056
5073
  $.each($t.p.colModel,function(){
5057
5074
  var cm=this, thd , th, soptions,surl,self;
5058
5075
  th = $("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+$t.p.direction+"'></th>");
5059
- thd = $("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");
5076
+ thd = $("<div style='position:relative;height:100%;padding-right:0.3em;'></div>");
5060
5077
  if(this.hidden===true) { $(th).css("display","none");}
5061
5078
  this.search = this.search === false ? false : true;
5062
- if(typeof this.stype == 'undefined' ) {this.stype='text';}
5079
+ if(this.stype === undefined) {this.stype='text';}
5063
5080
  soptions = $.extend({},this.searchoptions || {});
5064
5081
  if(this.search){
5065
5082
  switch (this.stype)
@@ -5085,8 +5102,7 @@ $.jgrid.extend({
5085
5102
  if(soptions.attr) {$("select",self).attr(soptions.attr);}
5086
5103
  $("select",self).css({width: "100%"});
5087
5104
  // preserve autoserch
5088
- if(soptions.dataInit !== undefined) { soptions.dataInit($("select",self)[0]); }
5089
- if(soptions.dataEvents !== undefined) { bindEvents($("select",self)[0],soptions.dataEvents); }
5105
+ $.jgrid.bindEv( $("select",self)[0], soptions, $t);
5090
5106
  if(p.autosearch===true){
5091
5107
  $("select",self).change(function(){
5092
5108
  triggerToolbar();
@@ -5111,17 +5127,17 @@ $.jgrid.extend({
5111
5127
  var elem = document.createElement("select");
5112
5128
  elem.style.width = "100%";
5113
5129
  $(elem).attr({name:cm.index || cm.name, id: "gs_"+cm.name});
5114
- var so, sv, ov;
5130
+ var so, sv, ov, key, k;
5115
5131
  if(typeof oSv === "string") {
5116
5132
  so = oSv.split(delim);
5117
- for(var k=0; k<so.length;k++){
5133
+ for(k=0; k<so.length;k++){
5118
5134
  sv = so[k].split(sep);
5119
5135
  ov = document.createElement("option");
5120
5136
  ov.value = sv[0]; ov.innerHTML = sv[1];
5121
5137
  elem.appendChild(ov);
5122
5138
  }
5123
5139
  } else if(typeof oSv === "object" ) {
5124
- for ( var key in oSv) {
5140
+ for (key in oSv) {
5125
5141
  if(oSv.hasOwnProperty(key)) {
5126
5142
  ov = document.createElement("option");
5127
5143
  ov.value = key; ov.innerHTML = oSv[key];
@@ -5131,8 +5147,7 @@ $.jgrid.extend({
5131
5147
  }
5132
5148
  if(soptions.defaultValue !== undefined) { $(elem).val(soptions.defaultValue); }
5133
5149
  if(soptions.attr) {$(elem).attr(soptions.attr);}
5134
- if(soptions.dataInit !== undefined) { soptions.dataInit(elem); }
5135
- if(soptions.dataEvents !== undefined) { bindEvents(elem, soptions.dataEvents); }
5150
+ $.jgrid.bindEv( elem , soptions, $t);
5136
5151
  $(thd).append(elem);
5137
5152
  if(p.autosearch===true){
5138
5153
  $(elem).change(function(){
@@ -5147,12 +5162,11 @@ $.jgrid.extend({
5147
5162
  var df = soptions.defaultValue !== undefined ? soptions.defaultValue: "";
5148
5163
  $(thd).append("<input type='text' style='width:95%;padding:0px;' name='"+(cm.index || cm.name)+"' id='gs_"+cm.name+"' value='"+df+"'/>");
5149
5164
  if(soptions.attr) {$("input",thd).attr(soptions.attr);}
5150
- if(soptions.dataInit !== undefined) { soptions.dataInit($("input",thd)[0]); }
5151
- if(soptions.dataEvents !== undefined) { bindEvents($("input",thd)[0], soptions.dataEvents); }
5165
+ $.jgrid.bindEv( $("input",thd)[0], soptions, $t);
5152
5166
  if(p.autosearch===true){
5153
5167
  if(p.searchOnEnter) {
5154
5168
  $("input",thd).keypress(function(e){
5155
- var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
5169
+ var key = e.charCode || e.keyCode || 0;
5156
5170
  if(key == 13){
5157
5171
  triggerToolbar();
5158
5172
  return false;
@@ -5193,10 +5207,21 @@ $.jgrid.extend({
5193
5207
  this.toggleToolbar = toggleToolbar;
5194
5208
  });
5195
5209
  },
5196
-
5210
+ destroyFilterToolbar: function () {
5211
+ return this.each(function () {
5212
+ if (!this.ftoolbar) {
5213
+ return;
5214
+ }
5215
+ this.triggerToolbar = null;
5216
+ this.clearToolbar = null;
5217
+ this.toggleToolbar = null;
5218
+ this.ftoolbar = false;
5219
+ $(this.grid.hDiv).find("table thead tr.ui-search-toolbar").remove();
5220
+ });
5221
+ },
5197
5222
  destroyGroupHeader : function(nullHeader)
5198
5223
  {
5199
- if(typeof(nullHeader) == 'undefined') {
5224
+ if(nullHeader === undefined) {
5200
5225
  nullHeader = true;
5201
5226
  }
5202
5227
  return this.each(function()
@@ -5234,7 +5259,6 @@ $.jgrid.extend({
5234
5259
  }
5235
5260
  });
5236
5261
  },
5237
-
5238
5262
  setGroupHeaders : function ( o ) {
5239
5263
  o = $.extend({
5240
5264
  useColSpanStyle : false,
@@ -5265,8 +5289,8 @@ $.jgrid.extend({
5265
5289
  }
5266
5290
  var $firstRow,
5267
5291
  inColumnHeader = function (text, columnHeaders) {
5268
- var i = 0, length = columnHeaders.length;
5269
- for (; i < length; i++) {
5292
+ var length = columnHeaders.length, i;
5293
+ for (i = 0; i < length; i++) {
5270
5294
  if (columnHeaders[i].startColumnName === text) {
5271
5295
  return i;
5272
5296
  }
@@ -5472,15 +5496,15 @@ $.jgrid.extend({
5472
5496
  // data stuff
5473
5497
  //TODO support for setRowData
5474
5498
  $("#gview_"+$.jgrid.jqID($t.p.id)).append($t.grid.fbDiv);
5475
- jQuery($t.grid.bDiv).scroll(function () {
5476
- jQuery($t.grid.fbDiv).scrollTop(jQuery(this).scrollTop());
5499
+ $($t.grid.bDiv).scroll(function () {
5500
+ $($t.grid.fbDiv).scrollTop($(this).scrollTop());
5477
5501
  });
5478
5502
  if($t.p.hoverrows === true) {
5479
5503
  $("#"+$.jgrid.jqID($t.p.id)).unbind('mouseover').unbind('mouseout');
5480
5504
  }
5481
5505
  $($t).bind('jqGridAfterGridComplete.setFrozenColumns', function () {
5482
5506
  $("#"+$.jgrid.jqID($t.p.id)+"_frozen").remove();
5483
- jQuery($t.grid.fbDiv).height( jQuery($t.grid.bDiv).height()-16);
5507
+ $($t.grid.fbDiv).height($($t.grid.bDiv).height()-16);
5484
5508
  var btbl = $("#"+$.jgrid.jqID($t.p.id)).clone(true);
5485
5509
  $("tr",btbl).each(function(){
5486
5510
  $("td:gt("+maxfrozen+")",this).remove();
@@ -5530,7 +5554,8 @@ $.jgrid.extend({
5530
5554
  });
5531
5555
  }
5532
5556
  });
5533
- })(jQuery);/*
5557
+ })(jQuery);
5558
+ /*
5534
5559
  * jqFilter jQuery jqGrid filter addon.
5535
5560
  * Copyright (c) 2011, Tony Tomov, tony@trirand.com
5536
5561
  * Dual licensed under the MIT and GPL licenses
@@ -5557,9 +5582,11 @@ $.jgrid.extend({
5557
5582
  ]
5558
5583
  }
5559
5584
  */
5560
- /*global jQuery, $, window, navigator */
5585
+ /*jshint eqeqeq:false, eqnull:true, devel:true */
5586
+ /*global jQuery */
5561
5587
 
5562
5588
  (function ($) {
5589
+ "use strict";
5563
5590
 
5564
5591
  $.fn.jqFilter = function( arg ) {
5565
5592
  if (typeof arg === 'string') {
@@ -5787,7 +5814,7 @@ $.fn.jqFilter = function( arg ) {
5787
5814
  }
5788
5815
  for (i = 0; i < that.p.columns.length; i++) {
5789
5816
  // but show only serchable and serchhidden = true fields
5790
- var searchable = (typeof that.p.columns[i].search === 'undefined') ? true: that.p.columns[i].search ,
5817
+ var searchable = (that.p.columns[i].search === undefined) ? true: that.p.columns[i].search ,
5791
5818
  hidden = (that.p.columns[i].hidden === true),
5792
5819
  ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true);
5793
5820
  if ((ignoreHiding && searchable) || (searchable && !hidden)) {
@@ -5799,7 +5826,7 @@ $.fn.jqFilter = function( arg ) {
5799
5826
  var opr;
5800
5827
  if( cm.searchoptions.sopt ) {opr = cm.searchoptions.sopt;}
5801
5828
  else if(that.p.sopt) { opr= that.p.sopt; }
5802
- else if (cm.searchtype === 'string') {opr = that.p.stropts;}
5829
+ else if (cm.searchtype === 'string' || cm.searchtype === 'text' ) {opr = that.p.stropts;}
5803
5830
  else {opr = that.p.numopts;}
5804
5831
 
5805
5832
  group.rules.push({
@@ -5913,12 +5940,12 @@ $.fn.jqFilter = function( arg ) {
5913
5940
 
5914
5941
  if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;}
5915
5942
  else if(that.p.sopt) { op= that.p.sopt; }
5916
- else if (cm.searchtype === 'string') {op = that.p.stropts;}
5943
+ else if (cm.searchtype === 'string'|| cm.searchtype === 'text') {op = that.p.stropts;}
5917
5944
  else {op = that.p.numopts;}
5918
5945
  // operators
5919
5946
  var s ="", so = 0;
5920
5947
  aoprs = [];
5921
- $.each(that.p.ops, function() { aoprs.push(this.name) });
5948
+ $.each(that.p.ops, function() { aoprs.push(this.name); });
5922
5949
  for ( i = 0 ; i < op.length; i++) {
5923
5950
  ina = $.inArray(op[i],aoprs);
5924
5951
  if(ina !== -1) {
@@ -5932,12 +5959,13 @@ $.fn.jqFilter = function( arg ) {
5932
5959
  $(".selectopts",trpar).empty().append( s );
5933
5960
  $(".selectopts",trpar)[0].selectedIndex = 0;
5934
5961
  if( $.browser.msie && $.browser.version < 9) {
5935
- var sw = parseInt($("select.selectopts",trpar)[0].offsetWidth) + 1;
5962
+ var sw = parseInt($("select.selectopts",trpar)[0].offsetWidth, 10) + 1;
5936
5963
  $(".selectopts",trpar).width( sw );
5937
5964
  $(".selectopts",trpar).css("width","auto");
5938
5965
  }
5939
5966
  // data
5940
5967
  $(".data",trpar).empty().append( elm );
5968
+ $.jgrid.bindEv( elm, cm.searchoptions, that);
5941
5969
  $(".input-elm",trpar).bind('change',function( e ) {
5942
5970
  var tmo = $(this).hasClass("ui-autocomplete-input") ? 200 :0;
5943
5971
  setTimeout(function(){
@@ -5957,8 +5985,8 @@ $.fn.jqFilter = function( arg ) {
5957
5985
  var j=0;
5958
5986
  for (i = 0; i < that.p.columns.length; i++) {
5959
5987
  // but show only serchable and serchhidden = true fields
5960
- var searchable = (typeof that.p.columns[i].search === 'undefined') ? true: that.p.columns[i].search ,
5961
- hidden = (that.p.columns[i].hidden === true),
5988
+ var searchable = (that.p.columns[i].search === undefined) ? true: that.p.columns[i].search,
5989
+ hidden = (that.p.columns[i].hidden === true),
5962
5990
  ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true);
5963
5991
  if ((ignoreHiding && searchable) || (searchable && !hidden)) {
5964
5992
  selected = "";
@@ -5985,7 +6013,10 @@ $.fn.jqFilter = function( arg ) {
5985
6013
  }
5986
6014
  }
5987
6015
  var ruleDataInput = $.jgrid.createEl(cm.inputtype,cm.searchoptions, rule.data, true, that.p.ajaxSelectOptions, true);
5988
-
6016
+ if(rule.op == 'nu' || rule.op == 'nn') {
6017
+ $(ruleDataInput).attr('readonly','true');
6018
+ $(ruleDataInput).attr('disabled','true');
6019
+ } //retain the state of disabled text fields in case of null ops
5989
6020
  // dropdown for: choosing operator
5990
6021
  var ruleOperatorSelect = $("<select class='selectopts'></select>");
5991
6022
  ruleOperatorTd.append(ruleOperatorSelect);
@@ -6009,10 +6040,10 @@ $.fn.jqFilter = function( arg ) {
6009
6040
  // populate drop down with all available operators
6010
6041
  if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;}
6011
6042
  else if(that.p.sopt) { op= that.p.sopt; }
6012
- else if (cm.searchtype === 'string') {op = p.stropts;}
6043
+ else if (cm.searchtype === 'string' || cm.searchtype === 'text') {op = p.stropts;}
6013
6044
  else {op = that.p.numopts;}
6014
6045
  str="";
6015
- $.each(that.p.ops, function() { aoprs.push(this.name) });
6046
+ $.each(that.p.ops, function() { aoprs.push(this.name); });
6016
6047
  for ( i = 0; i < op.length; i++) {
6017
6048
  ina = $.inArray(op[i],aoprs);
6018
6049
  if(ina !== -1) {
@@ -6029,7 +6060,7 @@ $.fn.jqFilter = function( arg ) {
6029
6060
  // is created previously
6030
6061
  //ruleDataInput.setAttribute("type", "text");
6031
6062
  ruleDataTd.append(ruleDataInput);
6032
-
6063
+ $.jgrid.bindEv( ruleDataInput, cm.searchoptions, that);
6033
6064
  $(ruleDataInput)
6034
6065
  .addClass("input-elm")
6035
6066
  .bind('change', function() {
@@ -6092,9 +6123,8 @@ $.fn.jqFilter = function( arg ) {
6092
6123
 
6093
6124
  if (s === "()") {
6094
6125
  return ""; // ignore groups that don't have rules
6095
- } else {
6096
- return s;
6097
6126
  }
6127
+ return s;
6098
6128
  };
6099
6129
  this.getStringForRule = function(rule) {
6100
6130
  var opUF = "",opC="", i, cm, ret, val,
@@ -6112,6 +6142,7 @@ $.fn.jqFilter = function( arg ) {
6112
6142
  break;
6113
6143
  }
6114
6144
  }
6145
+ if (cm == null) { return ""; }
6115
6146
  val = rule.data;
6116
6147
  if(opC === 'bw' || opC === 'bn') { val = val+"%"; }
6117
6148
  if(opC === 'ew' || opC === 'en') { val = "%"+val; }
@@ -6190,9 +6221,8 @@ $.fn.jqFilter = function( arg ) {
6190
6221
 
6191
6222
  if (s === "()") {
6192
6223
  return ""; // ignore groups that don't have rules
6193
- } else {
6194
- return s;
6195
6224
  }
6225
+ return s;
6196
6226
  }
6197
6227
 
6198
6228
  return getStringForGroup(this.p.filter);
@@ -6247,7 +6277,7 @@ $.extend($.fn.jqFilter,{
6247
6277
  },
6248
6278
  addFilter: function (pfilter) {
6249
6279
  if (typeof pfilter === "string") {
6250
- pfilter = jQuery.jgrid.parse( pfilter );
6280
+ pfilter = $.jgrid.parse( pfilter );
6251
6281
  }
6252
6282
  this.each(function(){
6253
6283
  this.p.filter = pfilter;
@@ -6258,7 +6288,8 @@ $.extend($.fn.jqFilter,{
6258
6288
 
6259
6289
  });
6260
6290
  })(jQuery);
6261
-
6291
+ /*jshint eqeqeq:false, eqnull:true, devel:true */
6292
+ /*global xmlJsonClass, jQuery */
6262
6293
  (function($){
6263
6294
  /**
6264
6295
  * jqGrid extension for form editing Grid Data
@@ -6269,11 +6300,10 @@ $.extend($.fn.jqFilter,{
6269
6300
  * http://www.gnu.org/licenses/gpl-2.0.html
6270
6301
  **/
6271
6302
  "use strict";
6272
- /*global xmlJsonClass, jQuery, $ */
6273
6303
  var rp_ge = {};
6274
6304
  $.jgrid.extend({
6275
6305
  searchGrid : function (p) {
6276
- p = $.extend({
6306
+ p = $.extend(true, {
6277
6307
  recreateFilter: false,
6278
6308
  drag: true,
6279
6309
  sField:'searchField',
@@ -6328,7 +6358,7 @@ $.jgrid.extend({
6328
6358
  showFrm = true,
6329
6359
  IDs = {themodal:'searchmod'+fid,modalhead:'searchhd'+fid,modalcontent:'searchcnt'+fid, scrollelm : fid},
6330
6360
  defaultFilters = $t.p.postData[p.sFilter];
6331
- if(typeof(defaultFilters) === "string") {
6361
+ if(typeof defaultFilters === "string") {
6332
6362
  defaultFilters = $.jgrid.parse( defaultFilters );
6333
6363
  }
6334
6364
  if(p.recreateFilter === true) {
@@ -6336,7 +6366,7 @@ $.jgrid.extend({
6336
6366
  }
6337
6367
  function showFilter(_filter) {
6338
6368
  showFrm = $($t).triggerHandler("jqGridFilterBeforeShow", [_filter]);
6339
- if(typeof(showFrm) === "undefined") {
6369
+ if(showFrm === undefined) {
6340
6370
  showFrm = true;
6341
6371
  }
6342
6372
  if(showFrm && $.isFunction(p.beforeShowSearch)) {
@@ -6374,7 +6404,7 @@ $.jgrid.extend({
6374
6404
  }
6375
6405
  // find first searchable column and set it if no default filter
6376
6406
  if(!found) {
6377
- var searchable = (typeof n.search === 'undefined') ? true: n.search ,
6407
+ var searchable = (n.search === undefined) ? true: n.search ,
6378
6408
  hidden = (n.hidden === true),
6379
6409
  ignoreHiding = (n.searchoptions && n.searchoptions.searchhidden === true);
6380
6410
  if ((ignoreHiding && searchable) || (searchable && !hidden)) {
@@ -6504,7 +6534,7 @@ $.jgrid.extend({
6504
6534
  res = JSON.stringify(filters);
6505
6535
  } catch (e2) { }
6506
6536
  }
6507
- if(typeof(res)==="string") {
6537
+ if(typeof res==="string") {
6508
6538
  sdata[p.sFilter] = res;
6509
6539
  $.each([p.sField,p.sValue, p.sOper], function() {sdata[this] = "";});
6510
6540
  }
@@ -6561,7 +6591,7 @@ $.jgrid.extend({
6561
6591
  });
6562
6592
  },
6563
6593
  editGridRow : function(rowid, p){
6564
- p = $.extend({
6594
+ p = $.extend(true, {
6565
6595
  top : 0,
6566
6596
  left: 0,
6567
6597
  width: 300,
@@ -6646,8 +6676,8 @@ $.jgrid.extend({
6646
6676
  postdata[nm] = this.editoptions.custom_value.call($t, $("#"+$.jgrid.jqID(nm),frmtb),'get');
6647
6677
  if (postdata[nm] === undefined) {throw "e1";}
6648
6678
  } catch (e) {
6649
- if (e==="e1") {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose);}
6650
- else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose);}
6679
+ if (e==="e1") {$.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose);}
6680
+ else {$.jgrid.info_dialog($.jgrid.errors.errcap,e.message,$.jgrid.edit.bClose);}
6651
6681
  }
6652
6682
  return true;
6653
6683
  }
@@ -6714,12 +6744,12 @@ $.jgrid.extend({
6714
6744
  tmp = "";
6715
6745
  } else {
6716
6746
  if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
6717
- tmp = $("td:eq("+i+")",obj.rows[ind]).text();
6747
+ tmp = $("td[role='gridcell']:eq("+i+")",obj.rows[ind]).text();
6718
6748
  } else {
6719
6749
  try {
6720
- tmp = $.unformat.call(obj, $("td:eq("+i+")",obj.rows[ind]),{rowId:rowid, colModel:this},i);
6750
+ tmp = $.unformat.call(obj, $("td[role='gridcell']:eq("+i+")",obj.rows[ind]),{rowId:rowid, colModel:this},i);
6721
6751
  } catch (_) {
6722
- tmp = (this.edittype && this.edittype == "textarea") ? $("td:eq("+i+")",obj.rows[ind]).text() : $("td:eq("+i+")",obj.rows[ind]).html();
6752
+ tmp = (this.edittype && this.edittype == "textarea") ? $("td[role='gridcell']:eq("+i+")",obj.rows[ind]).text() : $("td[role='gridcell']:eq("+i+")",obj.rows[ind]).html();
6723
6753
  }
6724
6754
  if(!tmp || tmp == "&nbsp;" || tmp == "&#160;" || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';}
6725
6755
  }
@@ -6753,8 +6783,12 @@ $.jgrid.extend({
6753
6783
  $(tb).append(trdata);
6754
6784
  trdata[0].rp = rp;
6755
6785
  }
6756
- $("td:eq("+(cp-2)+")",trdata[0]).html( typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label);
6786
+ $("td:eq("+(cp-2)+")",trdata[0]).html(frmopt.label === undefined ? obj.p.colNames[i]: frmopt.label);
6757
6787
  $("td:eq("+(cp-1)+")",trdata[0]).append(frmopt.elmprefix).append(elc).append(frmopt.elmsuffix);
6788
+ if($.isFunction(opt.custom_value) && rowid !== "_empty" ) {
6789
+ opt.custom_value.call($t, $("#"+nm,"#"+frmgr),'set',tmp);
6790
+ }
6791
+ $.jgrid.bindEv( elc, opt, $t);
6758
6792
  retpos[cnt] = i;
6759
6793
  cnt++;
6760
6794
  }
@@ -6853,7 +6887,7 @@ $.jgrid.extend({
6853
6887
  });
6854
6888
  break;
6855
6889
  case "checkbox":
6856
- tmp = tmp+"";
6890
+ tmp = String(tmp);
6857
6891
  if(cm[i].editoptions && cm[i].editoptions.value) {
6858
6892
  var cb = cm[i].editoptions.value.split(":");
6859
6893
  if(cb[0] == tmp) {
@@ -6880,8 +6914,8 @@ $.jgrid.extend({
6880
6914
  cm[i].editoptions.custom_value.call($t, $("#"+nm,"#"+fmid),'set',tmp);
6881
6915
  } else {throw "e1";}
6882
6916
  } catch (e) {
6883
- if (e=="e1") {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);}
6884
- else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose);}
6917
+ if (e=="e1") {$.jgrid.info_dialog($.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,$.jgrid.edit.bClose);}
6918
+ else {$.jgrid.info_dialog($.jgrid.errors.errcap,e.message,$.jgrid.edit.bClose);}
6885
6919
  }
6886
6920
  break;
6887
6921
  }
@@ -6903,11 +6937,11 @@ $.jgrid.extend({
6903
6937
  var copydata, ret=[true,"",""], onCS = {}, opers = $t.p.prmNames, idname, oper, key, selr, i;
6904
6938
 
6905
6939
  var retvals = $($t).triggerHandler("jqGridAddEditBeforeCheckValues", [$("#"+frmgr), frmoper]);
6906
- if(retvals && typeof(retvals) === 'object') {postdata = retvals;}
6940
+ if(retvals && typeof retvals === 'object') {postdata = retvals;}
6907
6941
 
6908
6942
  if($.isFunction(rp_ge[$t.p.id].beforeCheckValues)) {
6909
6943
  retvals = rp_ge[$t.p.id].beforeCheckValues.call($t, postdata,$("#"+frmgr),postdata[$t.p.id+"_id"] == "_empty" ? opers.addoper : opers.editoper);
6910
- if(retvals && typeof(retvals) === 'object') {postdata = retvals;}
6944
+ if(retvals && typeof retvals === 'object') {postdata = retvals;}
6911
6945
  }
6912
6946
  for( key in postdata ){
6913
6947
  if(postdata.hasOwnProperty(key)) {
@@ -6964,18 +6998,19 @@ $.jgrid.extend({
6964
6998
 
6965
6999
  postdata[idname] = $.jgrid.stripPref($t.p.idPrefix, postdata[idname]);
6966
7000
  var ajaxOptions = $.extend({
6967
- url: rp_ge[$t.p.id].url ? rp_ge[$t.p.id].url : $($t).jqGrid('getGridParam','editurl'),
7001
+ url: rp_ge[$t.p.id].url || $($t).jqGrid('getGridParam','editurl'),
6968
7002
  type: rp_ge[$t.p.id].mtype,
6969
7003
  data: $.isFunction(rp_ge[$t.p.id].serializeEditData) ? rp_ge[$t.p.id].serializeEditData.call($t,postdata) : postdata,
6970
- complete:function(data,Status){
7004
+ complete:function(data,status){
7005
+ var key;
6971
7006
  postdata[idname] = $t.p.idPrefix + postdata[idname];
6972
- if(Status != "success") {
7007
+ if(status != "success") {
6973
7008
  ret[0] = false;
6974
7009
  ret[1] = $($t).triggerHandler("jqGridAddEditErrorTextFormat", [data, frmoper]);
6975
7010
  if ($.isFunction(rp_ge[$t.p.id].errorTextFormat)) {
6976
7011
  ret[1] = rp_ge[$t.p.id].errorTextFormat.call($t, data);
6977
7012
  } else {
6978
- ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
7013
+ ret[1] = status + " Status: '" + data.statusText + "'. Error code: " + data.status;
6979
7014
  }
6980
7015
  } else {
6981
7016
  // data is posted successful
@@ -7017,9 +7052,9 @@ $.jgrid.extend({
7017
7052
  if($t.p.treeGrid === true){
7018
7053
  $($t).jqGrid("addChildNode",ret[2],selr,postdata );
7019
7054
  } else {
7020
- $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow);
7021
- $($t).jqGrid("setSelection",ret[2]);
7022
- }
7055
+ $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow);
7056
+ $($t).jqGrid("setSelection",ret[2]);
7057
+ }
7023
7058
  }
7024
7059
  $.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:"#gbox_"+$.jgrid.jqID(gID),jqm:p.jqModal,onClose: rp_ge[$t.p.id].onClose});
7025
7060
  } else if (rp_ge[$t.p.id].clearAfterAdd) {
@@ -7039,7 +7074,7 @@ $.jgrid.extend({
7039
7074
  $($t).jqGrid("addChildNode",ret[2],selr,postdata );
7040
7075
  } else {
7041
7076
  $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow);
7042
- }
7077
+ }
7043
7078
  }
7044
7079
  }
7045
7080
  } else {
@@ -7064,17 +7099,17 @@ $.jgrid.extend({
7064
7099
  copydata=null;
7065
7100
  },500);
7066
7101
  }
7067
- if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {
7068
- $("#"+frmgr).data("disabled",false);
7069
- if(rp_ge[$t.p.id]._savedData[$t.p.id+"_id"] !="_empty"){
7070
- for(var key in rp_ge[$t.p.id]._savedData) {
7071
- if(postdata[key]) {
7072
- rp_ge[$t.p.id]._savedData[key] = postdata[key];
7102
+ if(rp_ge[$t.p.id].checkOnSubmit || rp_ge[$t.p.id].checkOnUpdate) {
7103
+ $("#"+frmgr).data("disabled",false);
7104
+ if(rp_ge[$t.p.id]._savedData[$t.p.id+"_id"] !="_empty"){
7105
+ for(key in rp_ge[$t.p.id]._savedData) {
7106
+ if(rp_ge[$t.p.id]._savedData.hasOwnProperty(key) && postdata[key]) {
7107
+ rp_ge[$t.p.id]._savedData[key] = postdata[key];
7108
+ }
7073
7109
  }
7074
7110
  }
7075
7111
  }
7076
7112
  }
7077
- }
7078
7113
  rp_ge[$t.p.id].processing=false;
7079
7114
  $("#sData", frmtb+"_2").removeClass('ui-state-active');
7080
7115
  try{$(':input:visible',"#"+frmgr)[0].focus();} catch (e){}
@@ -7091,7 +7126,7 @@ $.jgrid.extend({
7091
7126
  if (ret[0]) {
7092
7127
  if (rp_ge[$t.p.id].useDataProxy) {
7093
7128
  var dpret = $t.p.dataProxy.call($t, ajaxOptions, "set_"+$t.p.id);
7094
- if(typeof(dpret) == "undefined") {
7129
+ if(dpret === undefined) {
7095
7130
  dpret = [true, ""];
7096
7131
  }
7097
7132
  if(dpret[0] === false ) {
@@ -7119,7 +7154,7 @@ $.jgrid.extend({
7119
7154
  function compareData(nObj, oObj ) {
7120
7155
  var ret = false,key;
7121
7156
  for (key in nObj) {
7122
- if(nObj[key] != oObj[key]) {
7157
+ if(nObj.hasOwnProperty(key) && nObj[key] != oObj[key]) {
7123
7158
  ret = true;
7124
7159
  break;
7125
7160
  }
@@ -7144,8 +7179,9 @@ $.jgrid.extend({
7144
7179
  }
7145
7180
  function restoreInline()
7146
7181
  {
7147
- if (rowid !== "_empty" && typeof($t.p.savedRow) !== "undefined" && $t.p.savedRow.length > 0 && $.isFunction($.fn.jqGrid.restoreRow)) {
7148
- for (var i=0;i<$t.p.savedRow.length;i++) {
7182
+ var i;
7183
+ if (rowid !== "_empty" && $t.p.savedRow !== undefined && $t.p.savedRow.length > 0 && $.isFunction($.fn.jqGrid.restoreRow)) {
7184
+ for (i=0;i<$t.p.savedRow.length;i++) {
7149
7185
  if ($t.p.savedRow[i].id == rowid) {
7150
7186
  $($t).jqGrid('restoreRow',rowid);
7151
7187
  break;
@@ -7153,9 +7189,23 @@ $.jgrid.extend({
7153
7189
  }
7154
7190
  }
7155
7191
  }
7156
- function updateNav(cr,totr){
7157
- if (cr===0) {$("#pData",frmtb+"_2").addClass('ui-state-disabled');} else {$("#pData",frmtb+"_2").removeClass('ui-state-disabled');}
7158
- if (cr==totr) {$("#nData",frmtb+"_2").addClass('ui-state-disabled');} else {$("#nData",frmtb+"_2").removeClass('ui-state-disabled');}
7192
+ function updateNav(cr, posarr){
7193
+ var totr = posarr[1].length-1;
7194
+ if (cr===0) {
7195
+ $("#pData",frmtb+"_2").addClass('ui-state-disabled');
7196
+ } else if( posarr[1][cr-1] !== undefined && $("#"+$.jgrid.jqID(posarr[1][cr-1])).hasClass('ui-state-disabled')) {
7197
+ $("#pData",frmtb+"_2").addClass('ui-state-disabled');
7198
+ } else {
7199
+ $("#pData",frmtb+"_2").removeClass('ui-state-disabled');
7200
+ }
7201
+
7202
+ if (cr==totr) {
7203
+ $("#nData",frmtb+"_2").addClass('ui-state-disabled');
7204
+ } else if( posarr[1][cr+1] !== undefined && $("#"+$.jgrid.jqID(posarr[1][cr+1])).hasClass('ui-state-disabled')) {
7205
+ $("#nData",frmtb+"_2").addClass('ui-state-disabled');
7206
+ } else {
7207
+ $("#nData",frmtb+"_2").removeClass('ui-state-disabled');
7208
+ }
7159
7209
  }
7160
7210
  function getCurrPos() {
7161
7211
  var rowsInGrid = $($t).jqGrid("getDataIDs"),
@@ -7166,7 +7216,7 @@ $.jgrid.extend({
7166
7216
 
7167
7217
  if ( $("#"+$.jgrid.jqID(IDs.themodal))[0] !== undefined ) {
7168
7218
  showFrm = $($t).triggerHandler("jqGridAddEditBeforeInitData", [$("#"+$.jgrid.jqID(frmgr)), frmoper]);
7169
- if(typeof(showFrm) == "undefined") {
7219
+ if(showFrm === undefined) {
7170
7220
  showFrm = true;
7171
7221
  }
7172
7222
  if(showFrm && onBeforeInit) {
@@ -7222,7 +7272,7 @@ $.jgrid.extend({
7222
7272
  frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>").data("disabled",false),
7223
7273
  tbl = $("<table id='"+frmtborg+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");
7224
7274
  showFrm = $($t).triggerHandler("jqGridAddEditBeforeInitData", [$("#"+frmgr), frmoper]);
7225
- if(typeof(showFrm) == "undefined") {
7275
+ if(showFrm === undefined) {
7226
7276
  showFrm = true;
7227
7277
  }
7228
7278
  if(showFrm && onBeforeInit) {
@@ -7298,7 +7348,7 @@ $.jgrid.extend({
7298
7348
  }
7299
7349
  if(e.which === 27) {
7300
7350
  if(!checkUpdates()) {return false;}
7301
- if(cle) {$.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});}
7351
+ if(cle) {$.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:p.gbox,jqm:p.jqModal, onClose: rp_ge[$t.p.id].onClose});}
7302
7352
  return false;
7303
7353
  }
7304
7354
  if(rp_ge[$t.p.id].navkeys[0]===true) {
@@ -7417,7 +7467,7 @@ $.jgrid.extend({
7417
7467
  npos[0] = parseInt(npos[0],10);
7418
7468
  if(npos[0] != -1 && npos[1][npos[0]+1]) {
7419
7469
  $($t).triggerHandler("jqGridAddEditClickPgButtons", ['next',$("#"+frmgr),npos[1][npos[0]]]);
7420
- var nposret = true;
7470
+ var nposret;
7421
7471
  if($.isFunction(p.onclickPgButtons)) {
7422
7472
  nposret = p.onclickPgButtons.call($t, 'next',$("#"+frmgr),npos[1][npos[0]]);
7423
7473
  if( nposret !== undefined && nposret === false ) {return false;}
@@ -7429,7 +7479,7 @@ $.jgrid.extend({
7429
7479
  if($.isFunction(p.afterclickPgButtons)) {
7430
7480
  p.afterclickPgButtons.call($t, 'next',$("#"+frmgr),npos[1][npos[0]+1]);
7431
7481
  }
7432
- updateNav(npos[0]+1,npos[1].length-1);
7482
+ updateNav(npos[0]+1,npos);
7433
7483
  }
7434
7484
  return false;
7435
7485
  });
@@ -7439,7 +7489,7 @@ $.jgrid.extend({
7439
7489
  var ppos = getCurrPos();
7440
7490
  if(ppos[0] != -1 && ppos[1][ppos[0]-1]) {
7441
7491
  $($t).triggerHandler("jqGridAddEditClickPgButtons", ['prev',$("#"+frmgr),ppos[1][ppos[0]]]);
7442
- var pposret = true;
7492
+ var pposret;
7443
7493
  if($.isFunction(p.onclickPgButtons)) {
7444
7494
  pposret = p.onclickPgButtons.call($t, 'prev',$("#"+frmgr),ppos[1][ppos[0]]);
7445
7495
  if( pposret !== undefined && pposret === false ) {return false;}
@@ -7451,18 +7501,18 @@ $.jgrid.extend({
7451
7501
  if($.isFunction(p.afterclickPgButtons)) {
7452
7502
  p.afterclickPgButtons.call($t, 'prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
7453
7503
  }
7454
- updateNav(ppos[0]-1,ppos[1].length-1);
7504
+ updateNav(ppos[0]-1,ppos);
7455
7505
  }
7456
7506
  return false;
7457
7507
  });
7458
7508
  }
7459
7509
  var posInit =getCurrPos();
7460
- updateNav(posInit[0],posInit[1].length-1);
7510
+ updateNav(posInit[0],posInit);
7461
7511
 
7462
7512
  });
7463
7513
  },
7464
7514
  viewGridRow : function(rowid, p){
7465
- p = $.extend({
7515
+ p = $.extend(true, {
7466
7516
  top : 0,
7467
7517
  left: 0,
7468
7518
  width: 0,
@@ -7499,11 +7549,11 @@ $.jgrid.extend({
7499
7549
  }
7500
7550
  }
7501
7551
  function createData(rowid,obj,tb,maxcols){
7502
- var nm, hc,trdata, cnt=0,tmp, dc, retpos=[], ind=false,
7552
+ var nm, hc,trdata, cnt=0,tmp, dc, retpos=[], ind=false, i,
7503
7553
  tdtmpl = "<td class='CaptionTD form-view-label ui-widget-content' width='"+p.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>", tmpl="",
7504
7554
  tdtmpl2 = "<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>",
7505
7555
  fmtnum = ['integer','number','currency'],max1 =0, max2=0 ,maxw,setme, viewfld;
7506
- for (var i =1;i<=maxcols;i++) {
7556
+ for (i=1;i<=maxcols;i++) {
7507
7557
  tmpl += i == 1 ? tdtmpl : tdtmpl2;
7508
7558
  }
7509
7559
  // find max number align rigth with property formatter
@@ -7533,7 +7583,7 @@ $.jgrid.extend({
7533
7583
  hc = this.hidden === true ? true : false;
7534
7584
  }
7535
7585
  dc = hc ? "style='display:none'" : "";
7536
- viewfld = (typeof this.viewable != 'boolean') ? true : this.viewable;
7586
+ viewfld = (typeof this.viewable !== 'boolean') ? true : this.viewable;
7537
7587
  if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && viewfld) {
7538
7588
  if(ind === false) {
7539
7589
  tmp = "";
@@ -7560,7 +7610,7 @@ $.jgrid.extend({
7560
7610
  $(tb).append(trdata);
7561
7611
  trdata[0].rp = rp;
7562
7612
  }
7563
- $("td:eq("+(cp-2)+")",trdata[0]).html('<b>'+ (typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label)+'</b>');
7613
+ $("td:eq("+(cp-2)+")",trdata[0]).html('<b>'+ (frmopt.label === undefined ? obj.p.colNames[i]: frmopt.label)+'</b>');
7564
7614
  $("td:eq("+(cp-1)+")",trdata[0]).append("<span>"+tmp+"</span>").attr("id","v_"+nm);
7565
7615
  if(setme){
7566
7616
  $("td:eq("+(cp-1)+") span",trdata[0]).css({'text-align':'right',width:maxw+"px"});
@@ -7603,9 +7653,22 @@ $.jgrid.extend({
7603
7653
  });
7604
7654
  if(cnt>0) {$("#id_g","#"+frmtb).val(rowid);}
7605
7655
  }
7606
- function updateNav(cr,totr){
7607
- if (cr===0) {$("#pData","#"+frmtb+"_2").addClass('ui-state-disabled');} else {$("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled');}
7608
- if (cr==totr) {$("#nData","#"+frmtb+"_2").addClass('ui-state-disabled');} else {$("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled');}
7656
+ function updateNav(cr,posarr){
7657
+ var totr = posarr[1].length-1;
7658
+ if (cr===0) {
7659
+ $("#pData","#"+frmtb+"_2").addClass('ui-state-disabled');
7660
+ } else if( posarr[1][cr-1] !== undefined && $("#"+$.jgrid.jqID(posarr[1][cr-1])).hasClass('ui-state-disabled')) {
7661
+ $("#pData",frmtb+"_2").addClass('ui-state-disabled');
7662
+ } else {
7663
+ $("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled');
7664
+ }
7665
+ if (cr==totr) {
7666
+ $("#nData","#"+frmtb+"_2").addClass('ui-state-disabled');
7667
+ } else if( posarr[1][cr+1] !== undefined && $("#"+$.jgrid.jqID(posarr[1][cr+1])).hasClass('ui-state-disabled')) {
7668
+ $("#nData",frmtb+"_2").addClass('ui-state-disabled');
7669
+ } else {
7670
+ $("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled');
7671
+ }
7609
7672
  }
7610
7673
  function getCurrPos() {
7611
7674
  var rowsInGrid = $($t).jqGrid("getDataIDs"),
@@ -7617,7 +7680,7 @@ $.jgrid.extend({
7617
7680
  if ( $("#"+$.jgrid.jqID(IDs.themodal))[0] !== undefined ) {
7618
7681
  if(onBeforeInit) {
7619
7682
  showFrm = onBeforeInit.call($t,$("#"+frmgr));
7620
- if(typeof(showFrm) == "undefined") {
7683
+ if(showFrm === undefined) {
7621
7684
  showFrm = true;
7622
7685
  }
7623
7686
  }
@@ -7634,7 +7697,7 @@ $.jgrid.extend({
7634
7697
  tbl =$("<table id='"+frmtb_id+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");
7635
7698
  if(onBeforeInit) {
7636
7699
  showFrm = onBeforeInit.call($t,$("#"+frmgr));
7637
- if(typeof(showFrm) == "undefined") {
7700
+ if(showFrm === undefined) {
7638
7701
  showFrm = true;
7639
7702
  }
7640
7703
  }
@@ -7680,7 +7743,7 @@ $.jgrid.extend({
7680
7743
  bt = null;
7681
7744
  $("#"+IDs.themodal).keydown( function( e ) {
7682
7745
  if(e.which === 27) {
7683
- if(rp_ge[$t.p.id].closeOnEscape) {$.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: p.onClose});}
7746
+ if(rp_ge[$t.p.id].closeOnEscape) {$.jgrid.hideModal("#"+$.jgrid.jqID(IDs.themodal),{gb:p.gbox,jqm:p.jqModal, onClose: p.onClose});}
7684
7747
  return false;
7685
7748
  }
7686
7749
  if(p.navkeys[0]===true) {
@@ -7723,7 +7786,7 @@ $.jgrid.extend({
7723
7786
  if($.isFunction(p.afterclickPgButtons)) {
7724
7787
  p.afterclickPgButtons.call($t,'next',$("#"+frmgr),npos[1][npos[0]+1]);
7725
7788
  }
7726
- updateNav(npos[0]+1,npos[1].length-1);
7789
+ updateNav(npos[0]+1,npos);
7727
7790
  }
7728
7791
  focusaref();
7729
7792
  return false;
@@ -7740,18 +7803,18 @@ $.jgrid.extend({
7740
7803
  if($.isFunction(p.afterclickPgButtons)) {
7741
7804
  p.afterclickPgButtons.call($t,'prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
7742
7805
  }
7743
- updateNav(ppos[0]-1,ppos[1].length-1);
7806
+ updateNav(ppos[0]-1,ppos);
7744
7807
  }
7745
7808
  focusaref();
7746
7809
  return false;
7747
7810
  });
7748
7811
  }
7749
7812
  var posInit =getCurrPos();
7750
- updateNav(posInit[0],posInit[1].length-1);
7813
+ updateNav(posInit[0],posInit);
7751
7814
  });
7752
7815
  },
7753
7816
  delGridRow : function(rowids,p) {
7754
- p = $.extend({
7817
+ p = $.extend(true, {
7755
7818
  top : 0,
7756
7819
  left: 0,
7757
7820
  width: 240,
@@ -7794,11 +7857,11 @@ $.jgrid.extend({
7794
7857
  dtbl = "DelTbl_"+$.jgrid.jqID(gID),postd, idname, opers, oper,
7795
7858
  dtbl_id = "DelTbl_" + gID,
7796
7859
  IDs = {themodal:'delmod'+gID,modalhead:'delhd'+gID,modalcontent:'delcnt'+gID, scrollelm: dtbl};
7797
- if (jQuery.isArray(rowids)) {rowids = rowids.join();}
7860
+ if ($.isArray(rowids)) {rowids = rowids.join();}
7798
7861
  if ( $("#"+$.jgrid.jqID(IDs.themodal))[0] !== undefined ) {
7799
7862
  if(onBeforeInit) {
7800
7863
  showFrm = onBeforeInit.call($t,$("#"+dtbl));
7801
- if(typeof(showFrm) == "undefined") {
7864
+ if(showFrm === undefined) {
7802
7865
  showFrm = true;
7803
7866
  }
7804
7867
  }
@@ -7830,7 +7893,7 @@ $.jgrid.extend({
7830
7893
 
7831
7894
  if(onBeforeInit) {
7832
7895
  showFrm = onBeforeInit.call($t,$("#"+dtbl));
7833
- if(typeof(showFrm) == "undefined") {
7896
+ if(showFrm === undefined) {
7834
7897
  showFrm = true;
7835
7898
  }
7836
7899
  }
@@ -7851,8 +7914,9 @@ $.jgrid.extend({
7851
7914
  .append("<span class='ui-icon "+p.cancelicon[2]+"'></span>");
7852
7915
  }
7853
7916
  $("#dData","#"+dtbl+"_2").click(function(){
7854
- var ret=[true,""];onCS = {};
7855
- var postdata = $("#DelData>td","#"+dtbl).text(); //the pair is name=val1,val2,...
7917
+ var ret=[true,""], pk,
7918
+ postdata = $("#DelData>td","#"+dtbl).text(); //the pair is name=val1,val2,...
7919
+ onCS = {};
7856
7920
  if( $.isFunction( rp_ge[$t.p.id].onclickSubmit ) ) {onCS = rp_ge[$t.p.id].onclickSubmit.call($t,rp_ge[$t.p.id], postdata) || {};}
7857
7921
  if( $.isFunction( rp_ge[$t.p.id].beforeSubmit ) ) {ret = rp_ge[$t.p.id].beforeSubmit.call($t,postdata);}
7858
7922
  if(ret[0] && !rp_ge[$t.p.id].processing) {
@@ -7864,7 +7928,7 @@ $.jgrid.extend({
7864
7928
  idname = opers.id;
7865
7929
  postdata = String(postdata).split(",");
7866
7930
  if(!postdata.length) { return false; }
7867
- for( var pk in postdata) {
7931
+ for(pk in postdata) {
7868
7932
  if(postdata.hasOwnProperty(pk)) {
7869
7933
  postdata[pk] = $.jgrid.stripPref($t.p.idPrefix, postdata[pk]);
7870
7934
  }
@@ -7872,16 +7936,17 @@ $.jgrid.extend({
7872
7936
  postd[idname] = postdata.join();
7873
7937
  $(this).addClass('ui-state-active');
7874
7938
  var ajaxOptions = $.extend({
7875
- url: rp_ge[$t.p.id].url ? rp_ge[$t.p.id].url : $($t).jqGrid('getGridParam','editurl'),
7939
+ url: rp_ge[$t.p.id].url || $($t).jqGrid('getGridParam','editurl'),
7876
7940
  type: rp_ge[$t.p.id].mtype,
7877
7941
  data: $.isFunction(rp_ge[$t.p.id].serializeDelData) ? rp_ge[$t.p.id].serializeDelData.call($t,postd) : postd,
7878
- complete:function(data,Status){
7879
- if(Status != "success") {
7942
+ complete:function(data,status){
7943
+ var i;
7944
+ if(status != "success") {
7880
7945
  ret[0] = false;
7881
7946
  if ($.isFunction(rp_ge[$t.p.id].errorTextFormat)) {
7882
7947
  ret[1] = rp_ge[$t.p.id].errorTextFormat.call($t,data);
7883
7948
  } else {
7884
- ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
7949
+ ret[1] = status + " Status: '" + data.statusText + "'. Error code: " + data.status;
7885
7950
  }
7886
7951
  } else {
7887
7952
  // data is posted successful
@@ -7900,7 +7965,7 @@ $.jgrid.extend({
7900
7965
  if($t.p.treeGrid===true){
7901
7966
  try {$($t).jqGrid("delTreeNode",$t.p.idPrefix+postdata[0]);} catch(e){}
7902
7967
  } else {
7903
- for(var i=0;i<postdata.length;i++) {
7968
+ for(i=0;i<postdata.length;i++) {
7904
7969
  $($t).jqGrid("delRowData",$t.p.idPrefix+ postdata[i]);
7905
7970
  }
7906
7971
  }
@@ -7928,7 +7993,7 @@ $.jgrid.extend({
7928
7993
  if (ret[0]) {
7929
7994
  if (rp_ge[$t.p.id].useDataProxy) {
7930
7995
  var dpret = $t.p.dataProxy.call($t, ajaxOptions, "del_"+$t.p.id);
7931
- if(typeof(dpret) == "undefined") {
7996
+ if(dpret === undefined) {
7932
7997
  dpret = [true, ""];
7933
7998
  }
7934
7999
  if(dpret[0] === false ) {
@@ -7989,15 +8054,15 @@ $.jgrid.extend({
7989
8054
  }, $.jgrid.nav, o ||{});
7990
8055
  return this.each(function() {
7991
8056
  if(this.nav) {return;}
7992
- var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'},
8057
+ var alertIDs = {themodal: 'alertmod_' + this.p.id, modalhead: 'alerthd_' + this.p.id,modalcontent: 'alertcnt_' + this.p.id},
7993
8058
  $t = this, twd, tdw;
7994
- if(!$t.grid || typeof elem != 'string') {return;}
8059
+ if(!$t.grid || typeof elem !== 'string') {return;}
7995
8060
  if ($("#"+alertIDs.themodal)[0] === undefined) {
7996
8061
  if(!o.alerttop && !o.alertleft) {
7997
- if (typeof window.innerWidth != 'undefined') {
8062
+ if (window.innerWidth !== undefined) {
7998
8063
  o.alertleft = window.innerWidth;
7999
8064
  o.alerttop = window.innerHeight;
8000
- } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth !== 0) {
8065
+ } else if (document.documentElement !== undefined && document.documentElement.clientWidth !== undefined && document.documentElement.clientWidth !== 0) {
8001
8066
  o.alertleft = document.documentElement.clientWidth;
8002
8067
  o.alerttop = document.documentElement.clientHeight;
8003
8068
  } else {
@@ -8007,11 +8072,37 @@ $.jgrid.extend({
8007
8072
  o.alertleft = o.alertleft/2 - parseInt(o.alertwidth,10)/2;
8008
8073
  o.alerttop = o.alerttop/2-25;
8009
8074
  }
8010
- $.jgrid.createModal(alertIDs,"<div>"+o.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+$.jgrid.jqID($t.p.id),jqModal:true,drag:true,resize:true,caption:o.alertcap,top:o.alerttop,left:o.alertleft,width:o.alertwidth,height: o.alertheight,closeOnEscape:o.closeOnEscape, zIndex: o.alertzIndex},"","",true);
8075
+ $.jgrid.createModal(alertIDs,
8076
+ "<div>"+o.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",
8077
+ {
8078
+ gbox:"#gbox_"+$.jgrid.jqID($t.p.id),
8079
+ jqModal:true,
8080
+ drag:true,
8081
+ resize:true,
8082
+ caption:o.alertcap,
8083
+ top:o.alerttop,
8084
+ left:o.alertleft,
8085
+ width:o.alertwidth,
8086
+ height: o.alertheight,
8087
+ closeOnEscape:o.closeOnEscape,
8088
+ zIndex: o.alertzIndex
8089
+ },
8090
+ "#gview_"+$.jgrid.jqID($t.p.id),
8091
+ $("#gbox_"+$.jgrid.jqID($t.p.id))[0],
8092
+ true
8093
+ );
8011
8094
  }
8012
- var clone = 1;
8095
+ var clone = 1, i,
8096
+ onHoverIn = function () {
8097
+ if (!$(this).hasClass('ui-state-disabled')) {
8098
+ $(this).addClass("ui-state-hover");
8099
+ }
8100
+ },
8101
+ onHoverOut = function () {
8102
+ $(this).removeClass("ui-state-hover");
8103
+ };
8013
8104
  if(o.cloneToTop && $t.p.toppager) {clone = 2;}
8014
- for(var i = 0; i<clone; i++) {
8105
+ for(i = 0; i<clone; i++) {
8015
8106
  var tbd,
8016
8107
  navtbl = $("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
8017
8108
  sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
@@ -8044,14 +8135,7 @@ $.jgrid.extend({
8044
8135
  }
8045
8136
  }
8046
8137
  return false;
8047
- }).hover(
8048
- function () {
8049
- if (!$(this).hasClass('ui-state-disabled')) {
8050
- $(this).addClass("ui-state-hover");
8051
- }
8052
- },
8053
- function () {$(this).removeClass("ui-state-hover");}
8054
- );
8138
+ }).hover(onHoverIn, onHoverOut);
8055
8139
  tbd = null;
8056
8140
  }
8057
8141
  if (o.edit) {
@@ -8076,14 +8160,7 @@ $.jgrid.extend({
8076
8160
  }
8077
8161
  }
8078
8162
  return false;
8079
- }).hover(
8080
- function () {
8081
- if (!$(this).hasClass('ui-state-disabled')) {
8082
- $(this).addClass("ui-state-hover");
8083
- }
8084
- },
8085
- function () {$(this).removeClass("ui-state-hover");}
8086
- );
8163
+ }).hover(onHoverIn, onHoverOut);
8087
8164
  tbd = null;
8088
8165
  }
8089
8166
  if (o.view) {
@@ -8108,14 +8185,7 @@ $.jgrid.extend({
8108
8185
  }
8109
8186
  }
8110
8187
  return false;
8111
- }).hover(
8112
- function () {
8113
- if (!$(this).hasClass('ui-state-disabled')) {
8114
- $(this).addClass("ui-state-hover");
8115
- }
8116
- },
8117
- function () {$(this).removeClass("ui-state-hover");}
8118
- );
8188
+ }).hover(onHoverIn, onHoverOut);
8119
8189
  tbd = null;
8120
8190
  }
8121
8191
  if (o.del) {
@@ -8145,14 +8215,7 @@ $.jgrid.extend({
8145
8215
  }
8146
8216
  }
8147
8217
  return false;
8148
- }).hover(
8149
- function () {
8150
- if (!$(this).hasClass('ui-state-disabled')) {
8151
- $(this).addClass("ui-state-hover");
8152
- }
8153
- },
8154
- function () {$(this).removeClass("ui-state-hover");}
8155
- );
8218
+ }).hover(onHoverIn, onHoverOut);
8156
8219
  tbd = null;
8157
8220
  }
8158
8221
  if(o.add || o.edit || o.del || o.view) {$("tr",navtbl).append(sep);}
@@ -8172,14 +8235,7 @@ $.jgrid.extend({
8172
8235
  }
8173
8236
  }
8174
8237
  return false;
8175
- }).hover(
8176
- function () {
8177
- if (!$(this).hasClass('ui-state-disabled')) {
8178
- $(this).addClass("ui-state-hover");
8179
- }
8180
- },
8181
- function () {$(this).removeClass("ui-state-hover");}
8182
- );
8238
+ }).hover(onHoverIn, onHoverOut);
8183
8239
  if (pSearch.showOnLoad && pSearch.showOnLoad === true) {
8184
8240
  $(tbd,navtbl).click();
8185
8241
  }
@@ -8212,14 +8268,7 @@ $.jgrid.extend({
8212
8268
  if($.isFunction(o.afterRefresh)) {o.afterRefresh.call($t);}
8213
8269
  }
8214
8270
  return false;
8215
- }).hover(
8216
- function () {
8217
- if (!$(this).hasClass('ui-state-disabled')) {
8218
- $(this).addClass("ui-state-hover");
8219
- }
8220
- },
8221
- function () {$(this).removeClass("ui-state-hover");}
8222
- );
8271
+ }).hover(onHoverIn, onHoverOut);
8223
8272
  tbd = null;
8224
8273
  }
8225
8274
  tdw = $(".ui-jqgrid").css("font-size") || "11px";
@@ -8292,7 +8341,8 @@ $.jgrid.extend({
8292
8341
  navSeparatorAdd:function (elem,p) {
8293
8342
  p = $.extend({
8294
8343
  sepclass : "ui-separator",
8295
- sepcontent: ''
8344
+ sepcontent: '',
8345
+ position : "last"
8296
8346
  }, p ||{});
8297
8347
  return this.each(function() {
8298
8348
  if( !this.grid) {return;}
@@ -8300,17 +8350,26 @@ $.jgrid.extend({
8300
8350
  var findnav = $(".navtable",elem)[0];
8301
8351
  if(findnav) {
8302
8352
  var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+p.sepclass+"'></span>"+p.sepcontent+"</td>";
8303
- $("tr",findnav).append(sep);
8353
+ if (p.position === 'first') {
8354
+ if (findnav.rows[0].cells.length === 0) {
8355
+ $("tr", findnav).append(sep);
8356
+ } else {
8357
+ $("tr td:eq(0)", findnav).before(sep);
8358
+ }
8359
+ } else {
8360
+ $("tr", findnav).append(sep);
8361
+ }
8304
8362
  }
8305
8363
  });
8306
8364
  },
8307
8365
  GridToForm : function( rowid, formid ) {
8308
8366
  return this.each(function(){
8309
- var $t = this;
8367
+ var $t = this, i;
8310
8368
  if (!$t.grid) {return;}
8311
8369
  var rowdata = $($t).jqGrid("getRowData",rowid);
8312
8370
  if (rowdata) {
8313
- for(var i in rowdata) {
8371
+ for(i in rowdata) {
8372
+ if(rowdata.hasOwnProperty(i)) {
8314
8373
  if ( $("[name="+$.jgrid.jqID(i)+"]",formid).is("input:radio") || $("[name="+$.jgrid.jqID(i)+"]",formid).is("input:checkbox")) {
8315
8374
  $("[name="+$.jgrid.jqID(i)+"]",formid).each( function() {
8316
8375
  if( $(this).val() == rowdata[i] ) {
@@ -8325,6 +8384,7 @@ $.jgrid.extend({
8325
8384
  }
8326
8385
  }
8327
8386
  }
8387
+ }
8328
8388
  });
8329
8389
  },
8330
8390
  FormToGrid : function(rowid, formid, mode, position){
@@ -8344,27 +8404,29 @@ $.jgrid.extend({
8344
8404
  }
8345
8405
  });
8346
8406
  })(jQuery);
8407
+ /*jshint eqeqeq:false, eqnull:true */
8408
+ /*global jQuery */
8347
8409
  // Grouping module
8348
- ;(function($){
8410
+ (function($){
8349
8411
  "use strict";
8350
8412
  $.extend($.jgrid,{
8351
8413
  template : function(format){ //jqgformat
8352
- var args = $.makeArray(arguments).slice(1), j = 1;
8353
- if(format===undefined) { format = ""; }
8414
+ var args = $.makeArray(arguments).slice(1), j, al = args.length;
8415
+ if(format==null) { format = ""; }
8354
8416
  return format.replace(/\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g, function(m,i){
8355
8417
  if(!isNaN(parseInt(i,10))) {
8356
- j++;
8357
8418
  return args[parseInt(i,10)];
8358
- } else {
8359
- var nmarr = args[ j ],
8360
- k = nmarr.length;
8361
- while(k--) {
8362
- if(i===nmarr[k].nm) {
8363
- return nmarr[k].v;
8364
- break;
8419
+ }
8420
+ for(j=0; j < al;j++) {
8421
+ if($.isArray(args[j])) {
8422
+ var nmarr = args[ j ],
8423
+ k = nmarr.length;
8424
+ while(k--) {
8425
+ if(i===nmarr[k].nm) {
8426
+ return nmarr[k].v;
8427
+ }
8365
8428
  }
8366
8429
  }
8367
- j++;
8368
8430
  }
8369
8431
  });
8370
8432
  }
@@ -8372,30 +8434,29 @@ $.extend($.jgrid,{
8372
8434
  $.jgrid.extend({
8373
8435
  groupingSetup : function () {
8374
8436
  return this.each(function (){
8375
- var $t = this,
8376
- grp = $t.p.groupingView;
8437
+ var $t = this, i, j, cml, cm = $t.p.colModel, grp = $t.p.groupingView;
8377
8438
  if(grp !== null && ( (typeof grp === 'object') || $.isFunction(grp) ) ) {
8378
8439
  if(!grp.groupField.length) {
8379
8440
  $t.p.grouping = false;
8380
8441
  } else {
8381
- if ( typeof(grp.visibiltyOnNextGrouping) === 'undefined') {
8442
+ if (grp.visibiltyOnNextGrouping === undefined) {
8382
8443
  grp.visibiltyOnNextGrouping = [];
8383
8444
  }
8384
8445
 
8385
8446
  grp.lastvalues=[];
8386
8447
  grp.groups =[];
8387
8448
  grp.counters =[];
8388
- for(var i=0;i<grp.groupField.length;i++) {
8449
+ for(i=0;i<grp.groupField.length;i++) {
8389
8450
  if(!grp.groupOrder[i]) {
8390
8451
  grp.groupOrder[i] = 'asc';
8391
8452
  }
8392
8453
  if(!grp.groupText[i]) {
8393
8454
  grp.groupText[i] = '{0}';
8394
8455
  }
8395
- if( typeof(grp.groupColumnShow[i]) !== 'boolean') {
8456
+ if( typeof grp.groupColumnShow[i] !== 'boolean') {
8396
8457
  grp.groupColumnShow[i] = true;
8397
8458
  }
8398
- if( typeof(grp.groupSummary[i]) !== 'boolean') {
8459
+ if( typeof grp.groupSummary[i] !== 'boolean') {
8399
8460
  grp.groupSummary[i] = false;
8400
8461
  }
8401
8462
  if(grp.groupColumnShow[i] === true) {
@@ -8407,8 +8468,7 @@ $.jgrid.extend({
8407
8468
  }
8408
8469
  }
8409
8470
  grp.summary =[];
8410
- var cm = $t.p.colModel;
8411
- for(var j=0, cml = cm.length; j < cml; j++) {
8471
+ for(j=0, cml = cm.length; j < cml; j++) {
8412
8472
  if(cm[j].summaryType) {
8413
8473
  grp.summary.push({nm:cm[j].name,st:cm[j].summaryType, v: '', sr: cm[j].summaryRound, srt: cm[j].summaryRoundType || 'round'});
8414
8474
  }
@@ -8421,18 +8481,26 @@ $.jgrid.extend({
8421
8481
  },
8422
8482
  groupingPrepare : function (rData, gdata, record, irow) {
8423
8483
  this.each(function(){
8424
- var grp = this.p.groupingView, $t= this;
8425
- var grlen = grp.groupField.length,
8484
+ var grp = this.p.groupingView, $t= this, i,
8485
+ grlen = grp.groupField.length,
8426
8486
  fieldName,
8427
8487
  v,
8488
+ displayName,
8489
+ displayValue,
8428
8490
  changed = 0;
8429
- for(var i=0;i<grlen;i++) {
8491
+ for(i=0;i<grlen;i++) {
8430
8492
  fieldName = grp.groupField[i];
8493
+ displayName = grp.displayField[i];
8431
8494
  v = record[fieldName];
8495
+ displayValue = displayName == null ? null : record[displayName];
8496
+
8497
+ if( displayValue == null ) {
8498
+ displayValue = v;
8499
+ }
8432
8500
  if( v !== undefined ) {
8433
8501
  if(irow === 0 ) {
8434
8502
  // First record always starts a new group
8435
- grp.groups.push({idx:i,dataIndex:fieldName,value:v, startRow: irow, cnt:1, summary : [] } );
8503
+ grp.groups.push({idx:i,dataIndex:fieldName,value:v, displayValue: displayValue, startRow: irow, cnt:1, summary : [] } );
8436
8504
  grp.lastvalues[i] = v;
8437
8505
  grp.counters[i] = {cnt:1, pos:grp.groups.length-1, summary: $.extend(true,[],grp.summary)};
8438
8506
  $.each(grp.counters[i].summary,function() {
@@ -8444,9 +8512,9 @@ $.jgrid.extend({
8444
8512
  });
8445
8513
  grp.groups[grp.counters[i].pos].summary = grp.counters[i].summary;
8446
8514
  } else {
8447
- if( (typeof(v) !== "object" && (grp.lastvalues[i] !== v) ) ) {
8515
+ if( typeof v !== "object" && grp.lastvalues[i] !== v ) {
8448
8516
  // This record is not in same group as previous one
8449
- grp.groups.push({idx:i,dataIndex:fieldName,value:v, startRow: irow, cnt:1, summary : [] } );
8517
+ grp.groups.push({idx:i,dataIndex:fieldName,value:v, displayValue: displayValue, startRow: irow, cnt:1, summary : [] } );
8450
8518
  grp.lastvalues[i] = v;
8451
8519
  changed = 1;
8452
8520
  grp.counters[i] = {cnt:1, pos:grp.groups.length-1, summary: $.extend(true,[],grp.summary)};
@@ -8461,7 +8529,7 @@ $.jgrid.extend({
8461
8529
  } else {
8462
8530
  if (changed === 1) {
8463
8531
  // This group has changed because an earlier group changed.
8464
- grp.groups.push({idx:i,dataIndex:fieldName,value:v, startRow: irow, cnt:1, summary : [] } );
8532
+ grp.groups.push({idx:i,dataIndex:fieldName,value:v, displayValue: displayValue, startRow: irow, cnt:1, summary : [] } );
8465
8533
  grp.lastvalues[i] = v;
8466
8534
  grp.counters[i] = {cnt:1, pos:grp.groups.length-1, summary: $.extend(true,[],grp.summary)};
8467
8535
  $.each(grp.counters[i].summary,function() {
@@ -8556,11 +8624,11 @@ $.jgrid.extend({
8556
8624
  return this.each(function(){
8557
8625
  var $t = this,
8558
8626
  grp = $t.p.groupingView,
8559
- str = "", icon = "", hid, clid, pmrtl = grp.groupCollapse ? grp.plusicon : grp.minusicon, gv, cp=[], ii, len =grp.groupField.length;
8627
+ str = "", icon = "", hid, clid, pmrtl = grp.groupCollapse ? grp.plusicon : grp.minusicon, gv, cp=[], len =grp.groupField.length;
8560
8628
  pmrtl += " tree-wrap-"+$t.p.direction;
8561
- ii = 0;
8562
8629
  $.each($t.p.colModel, function (i,n){
8563
- for(var ii=0;ii<len;ii++) {
8630
+ var ii;
8631
+ for(ii=0;ii<len;ii++) {
8564
8632
  if(grp.groupField[ii] === n.name ) {
8565
8633
  cp[ii] = i;
8566
8634
  break;
@@ -8569,17 +8637,23 @@ $.jgrid.extend({
8569
8637
  });
8570
8638
  var toEnd = 0;
8571
8639
  function findGroupIdx( ind , offset, grp) {
8640
+ var ret = false, i;
8572
8641
  if(offset===0) {
8573
- return grp[ind];
8642
+ ret = grp[ind];
8574
8643
  } else {
8575
8644
  var id = grp[ind].idx;
8576
- if(id===0) { return grp[ind]; }
8577
- for(var i=ind;i >= 0; i--) {
8578
- if(grp[i].idx === id-offset) {
8579
- return grp[i];
8645
+ if(id===0) {
8646
+ ret = grp[ind];
8647
+ } else {
8648
+ for(i=ind;i >= 0; i--) {
8649
+ if(grp[i].idx === id-offset) {
8650
+ ret = grp[i];
8651
+ break;
8652
+ }
8580
8653
  }
8581
8654
  }
8582
8655
  }
8656
+ return ret;
8583
8657
  }
8584
8658
  var sumreverse = $.makeArray(grp.groupSummary);
8585
8659
  sumreverse.reverse();
@@ -8589,16 +8663,16 @@ $.jgrid.extend({
8589
8663
  hid = clid+"_"+i;
8590
8664
  icon = "<span style='cursor:pointer;' class='ui-icon "+pmrtl+"' onclick=\"jQuery('#"+$.jgrid.jqID($t.p.id)+"').jqGrid('groupingToggle','"+hid+"');return false;\"></span>";
8591
8665
  try {
8592
- gv = $t.formatter(hid, n.value, cp[n.idx], n.value );
8666
+ gv = $t.formatter(hid, n.displayValue, cp[n.idx], n.value );
8593
8667
  } catch (egv) {
8594
- gv = n.value;
8668
+ gv = n.displayValue;
8595
8669
  }
8596
8670
  str += "<tr id=\""+hid+"\" role=\"row\" class= \"ui-widget-content jqgroup ui-row-"+$t.p.direction+" "+clid+"\"><td style=\"padding-left:"+(n.idx * 12) + "px;"+"\" colspan=\""+colspans+"\">"+icon+$.jgrid.template(grp.groupText[n.idx], gv, n.cnt, n.summary)+"</td></tr>";
8597
8671
  var leaf = len-1 === n.idx;
8598
8672
  if( leaf ) {
8599
- var gg = grp.groups[i+1];
8673
+ var gg = grp.groups[i+1], k, kk, ik;
8600
8674
  var end = gg !== undefined ? grp.groups[i+1].startRow : grdata.length;
8601
- for(var kk=n.startRow;kk<end;kk++) {
8675
+ for(kk=n.startRow;kk<end;kk++) {
8602
8676
  str += grdata[kk].join('');
8603
8677
  }
8604
8678
  var jj;
@@ -8610,7 +8684,7 @@ $.jgrid.extend({
8610
8684
  }
8611
8685
  toEnd = grp.groupField.length - jj;
8612
8686
  }
8613
- for (var ik = 0; ik < toEnd; ik++) {
8687
+ for (ik = 0; ik < toEnd; ik++) {
8614
8688
  if(!sumreverse[ik]) { continue; }
8615
8689
  var hhdr = "";
8616
8690
  if(grp.groupCollapse && !grp.showSummaryOnHide) {
@@ -8620,7 +8694,7 @@ $.jgrid.extend({
8620
8694
  var fdata = findGroupIdx(i, ik, grp.groups),
8621
8695
  cm = $t.p.colModel,
8622
8696
  vv, grlen = fdata.cnt;
8623
- for(var k=0; k<colspans;k++) {
8697
+ for(k=0; k<colspans;k++) {
8624
8698
  var tmpdata = "<td "+$t.formatCol(k,1,'')+">&#160;</td>",
8625
8699
  tplfld = "{0}";
8626
8700
  $.each(fdata.summary,function(){
@@ -8628,7 +8702,7 @@ $.jgrid.extend({
8628
8702
  if(cm[k].summaryTpl) {
8629
8703
  tplfld = cm[k].summaryTpl;
8630
8704
  }
8631
- if(typeof(this.st) === 'string' && this.st.toLowerCase() === 'avg') {
8705
+ if(typeof this.st === 'string' && this.st.toLowerCase() === 'avg') {
8632
8706
  if(this.v && grlen > 0) {
8633
8707
  this.v = (this.v/grlen);
8634
8708
  }
@@ -8657,14 +8731,14 @@ $.jgrid.extend({
8657
8731
  groupingGroupBy : function (name, options ) {
8658
8732
  return this.each(function(){
8659
8733
  var $t = this;
8660
- if(typeof(name) === "string") {
8734
+ if(typeof name === "string") {
8661
8735
  name = [name];
8662
8736
  }
8663
8737
  var grp = $t.p.groupingView;
8664
8738
  $t.p.grouping = true;
8665
8739
 
8666
8740
  //Set default, in case visibilityOnNextGrouping is undefined
8667
- if (typeof grp.visibiltyOnNextGrouping === "undefined") {
8741
+ if (grp.visibiltyOnNextGrouping === undefined) {
8668
8742
  grp.visibiltyOnNextGrouping = [];
8669
8743
  }
8670
8744
  var i;
@@ -8686,14 +8760,14 @@ $.jgrid.extend({
8686
8760
  groupingRemove : function (current) {
8687
8761
  return this.each(function(){
8688
8762
  var $t = this;
8689
- if(typeof(current) === 'undefined') {
8763
+ if(current === undefined) {
8690
8764
  current = true;
8691
8765
  }
8692
8766
  $t.p.grouping = false;
8693
8767
  if(current===true) {
8694
- var grp = $t.p.groupingView;
8768
+ var grp = $t.p.groupingView, i;
8695
8769
  // show previous hidden groups if they are hidden and weren't removed yet
8696
- for(var i=0;i<grp.groupField.length;i++) {
8770
+ for(i=0;i<grp.groupField.length;i++) {
8697
8771
  if (!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) {
8698
8772
  $($t).jqGrid('showCol', grp.groupField);
8699
8773
  }
@@ -8730,9 +8804,8 @@ $.jgrid.extend({
8730
8804
  if(v==="") {v=0;}
8731
8805
  if(rc.hasOwnProperty(field)) {
8732
8806
  return v+1;
8733
- } else {
8734
- return 0;
8735
8807
  }
8808
+ return 0;
8736
8809
  },
8737
8810
 
8738
8811
  avg: function() {
@@ -8740,7 +8813,7 @@ $.jgrid.extend({
8740
8813
  // so use sum instead of duplicating the code (?)
8741
8814
  return funcs.sum();
8742
8815
  }
8743
- }
8816
+ };
8744
8817
 
8745
8818
  if(!funcs[fn]) {
8746
8819
  throw ("jqGrid Grouping No such method: " + fn);
@@ -8748,11 +8821,10 @@ $.jgrid.extend({
8748
8821
  var res = funcs[fn]();
8749
8822
 
8750
8823
  if (round != null) {
8751
- if (roundType == 'fixed')
8824
+ if (roundType == 'fixed') {
8752
8825
  res = res.toFixed(round);
8753
- else {
8826
+ } else {
8754
8827
  var mul = Math.pow(10, round);
8755
-
8756
8828
  res = Math.round(res * mul) / mul;
8757
8829
  }
8758
8830
  }
@@ -8762,7 +8834,9 @@ $.jgrid.extend({
8762
8834
  }
8763
8835
  });
8764
8836
  })(jQuery);
8765
- ;(function($){
8837
+ /*jshint eqeqeq:false, eqnull:true, devel:true */
8838
+ /*global jQuery, xmlJsonClass */
8839
+ (function($){
8766
8840
  /*
8767
8841
  * jqGrid extension for constructing Grid Data from external file
8768
8842
  * Tony Tomov tony@trirand.com
@@ -8771,8 +8845,6 @@ $.jgrid.extend({
8771
8845
  * http://www.opensource.org/licenses/mit-license.php
8772
8846
  * http://www.gnu.org/licenses/gpl-2.0.html
8773
8847
  **/
8774
- //jsHint options
8775
- /*global jQuery, $, alert, xmlJsonClass */
8776
8848
 
8777
8849
  "use strict";
8778
8850
  $.jgrid.extend({
@@ -8797,11 +8869,11 @@ $.jgrid.extend({
8797
8869
  var $t = this;
8798
8870
  var xmlConvert = function (xml,o) {
8799
8871
  var cnfg = $(o.xmlGrid.config,xml)[0];
8800
- var xmldata = $(o.xmlGrid.data,xml)[0], jstr, jstr1;
8872
+ var xmldata = $(o.xmlGrid.data,xml)[0], jstr, jstr1, key;
8801
8873
  if(xmlJsonClass.xml2json && $.jgrid.parse) {
8802
8874
  jstr = xmlJsonClass.xml2json(cnfg," ");
8803
8875
  jstr = $.jgrid.parse(jstr);
8804
- for(var key in jstr) {
8876
+ for(key in jstr) {
8805
8877
  if(jstr.hasOwnProperty(key)) {
8806
8878
  jstr1=jstr[key];
8807
8879
  }
@@ -8915,7 +8987,7 @@ $.jgrid.extend({
8915
8987
  var ret = null;
8916
8988
  this.each(function () {
8917
8989
  if(!this.grid) { return;}
8918
- var gprm = $.extend(true, {},$(this).jqGrid("getGridParam"));
8990
+ var key, gprm = $.extend(true, {},$(this).jqGrid("getGridParam"));
8919
8991
  // we need to check for:
8920
8992
  // 1.multiselect, 2.subgrid 3. treegrid and remove the unneded columns from colNames
8921
8993
  if(gprm.rownumbers) {
@@ -8932,7 +9004,7 @@ $.jgrid.extend({
8932
9004
  }
8933
9005
  gprm.knv = null;
8934
9006
  if(gprm.treeGrid) {
8935
- for (var key in gprm.treeReader) {
9007
+ for (key in gprm.treeReader) {
8936
9008
  if(gprm.treeReader.hasOwnProperty(key)) {
8937
9009
  gprm.colNames.splice(gprm.colNames.length-1);
8938
9010
  gprm.colModel.splice(gprm.colModel.length-1);
@@ -8976,7 +9048,10 @@ $.jgrid.extend({
8976
9048
  });
8977
9049
  }
8978
9050
  });
8979
- })(jQuery);;(function($){
9051
+ })(jQuery);
9052
+ /*jshint eqeqeq:false, eqnull:true, devel:true */
9053
+ /*global jQuery */
9054
+ (function($){
8980
9055
  /**
8981
9056
  * jqGrid extension for manipulating Grid Data
8982
9057
  * Tony Tomov tony@trirand.com
@@ -8985,8 +9060,6 @@ $.jgrid.extend({
8985
9060
  * http://www.opensource.org/licenses/mit-license.php
8986
9061
  * http://www.gnu.org/licenses/gpl-2.0.html
8987
9062
  **/
8988
- //jsHint options
8989
- /*global alert, $, jQuery */
8990
9063
  "use strict";
8991
9064
  $.jgrid.inlineEdit = $.jgrid.inlineEdit || {};
8992
9065
  $.jgrid.extend({
@@ -8998,17 +9071,17 @@ $.jgrid.extend({
8998
9071
  if( $.type(args[0]) === "object" ) {
8999
9072
  o = args[0];
9000
9073
  } else {
9001
- if (typeof keys !== "undefined") { o.keys = keys; }
9074
+ if (keys !== undefined) { o.keys = keys; }
9002
9075
  if ($.isFunction(oneditfunc)) { o.oneditfunc = oneditfunc; }
9003
9076
  if ($.isFunction(successfunc)) { o.successfunc = successfunc; }
9004
- if (typeof url !== "undefined") { o.url = url; }
9005
- if (typeof extraparam !== "undefined") { o.extraparam = extraparam; }
9077
+ if (url !== undefined) { o.url = url; }
9078
+ if (extraparam !== undefined) { o.extraparam = extraparam; }
9006
9079
  if ($.isFunction(aftersavefunc)) { o.aftersavefunc = aftersavefunc; }
9007
9080
  if ($.isFunction(errorfunc)) { o.errorfunc = errorfunc; }
9008
9081
  if ($.isFunction(afterrestorefunc)) { o.afterrestorefunc = afterrestorefunc; }
9009
9082
  // last two not as param, but as object (sorry)
9010
- //if (typeof restoreAfterError !== "undefined") { o.restoreAfterError = restoreAfterError; }
9011
- //if (typeof mtype !== "undefined") { o.mtype = mtype || "POST"; }
9083
+ //if (restoreAfterError !== undefined) { o.restoreAfterError = restoreAfterError; }
9084
+ //if (mtype !== undefined) { o.mtype = mtype || "POST"; }
9012
9085
  }
9013
9086
  o = $.extend(true, {
9014
9087
  keys : false,
@@ -9057,8 +9130,9 @@ $.jgrid.extend({
9057
9130
  $(elc).addClass("editable");
9058
9131
  if(treeg) { $("span:first",this).append(elc); }
9059
9132
  else { $(this).append(elc); }
9133
+ $.jgrid.bindEv( elc, opt, $t);
9060
9134
  //Again IE
9061
- if(cm[i].edittype == "select" && typeof(cm[i].editoptions)!=="undefined" && cm[i].editoptions.multiple===true && typeof(cm[i].editoptions.dataUrl)==="undefined" && $.browser.msie) {
9135
+ if(cm[i].edittype == "select" && cm[i].editoptions!==undefined && cm[i].editoptions.multiple===true && cm[i].editoptions.dataUrl===undefined && $.browser.msie) {
9062
9136
  $(elc).width($(elc).width());
9063
9137
  }
9064
9138
  cnt++;
@@ -9108,8 +9182,8 @@ $.jgrid.extend({
9108
9182
  o = args[0];
9109
9183
  } else {
9110
9184
  if ($.isFunction(successfunc)) { o.successfunc = successfunc; }
9111
- if (typeof url !== "undefined") { o.url = url; }
9112
- if (typeof extraparam !== "undefined") { o.extraparam = extraparam; }
9185
+ if (url !== undefined) { o.url = url; }
9186
+ if (extraparam !== undefined) { o.extraparam = extraparam; }
9113
9187
  if ($.isFunction(aftersavefunc)) { o.aftersavefunc = aftersavefunc; }
9114
9188
  if ($.isFunction(errorfunc)) { o.errorfunc = errorfunc; }
9115
9189
  if ($.isFunction(afterrestorefunc)) { o.afterrestorefunc = afterrestorefunc; }
@@ -9132,7 +9206,7 @@ $.jgrid.extend({
9132
9206
  ind = $($t).jqGrid("getInd",rowid,true);
9133
9207
  if(ind === false) {return success;}
9134
9208
  editable = $(ind).attr("editable");
9135
- o.url = o.url ? o.url : $t.p.editurl;
9209
+ o.url = o.url || $t.p.editurl;
9136
9210
  if (editable==="1") {
9137
9211
  var cm;
9138
9212
  $('td[role="gridcell"]',ind).each(function(i) {
@@ -9205,14 +9279,46 @@ $.jgrid.extend({
9205
9279
  }
9206
9280
  return success;
9207
9281
  }
9208
- var idname, opers, oper;
9209
- opers = $t.p.prmNames;
9210
- oper = opers.oper;
9211
- idname = opers.id;
9282
+ var idname, opers = $t.p.prmNames, oldRowId = rowid;
9283
+ if ($t.p.keyIndex === false) {
9284
+ idname = opers.id;
9285
+ } else {
9286
+ idname = $t.p.colModel[$t.p.keyIndex +
9287
+ ($t.p.rownumbers === true ? 1 : 0) +
9288
+ ($t.p.multiselect === true ? 1 : 0) +
9289
+ ($t.p.subGrid === true ? 1 : 0)].name;
9290
+ }
9212
9291
  if(tmp) {
9213
- tmp[oper] = opers.editoper;
9214
- tmp[idname] = rowid;
9215
- if(typeof($t.p.inlineData) == 'undefined') { $t.p.inlineData ={}; }
9292
+ tmp[opers.oper] = opers.editoper;
9293
+ if (tmp[idname] === undefined) {
9294
+ tmp[idname] = rowid;
9295
+ } else if (ind.id !== $t.p.idPrefix + tmp[idname]) {
9296
+ // rename rowid
9297
+ var oldid = $.jgrid.stripPref($t.p.idPrefix, rowid);
9298
+ if ($t.p._index[oldid] !== undefined) {
9299
+ $t.p._index[tmp[idname]] = $t.p._index[oldid];
9300
+ delete $t.p._index[oldid];
9301
+ }
9302
+ rowid = $t.p.idPrefix + tmp[idname];
9303
+ $(ind).attr("id", rowid);
9304
+ if ($t.p.selrow === oldRowId) {
9305
+ $t.p.selrow = rowid;
9306
+ }
9307
+ if ($.isArray($t.p.selarrrow)) {
9308
+ var i = $.inArray(oldRowId, $t.p.selarrrow);
9309
+ if (i>=0) {
9310
+ $t.p.selarrrow[i] = rowid;
9311
+ }
9312
+ }
9313
+ if ($t.p.multiselect) {
9314
+ var newCboxId = "jqg_" + $t.p.id + "_" + rowid;
9315
+ $("input.cbox",ind)
9316
+ .attr("id", newCboxId)
9317
+ .attr("name", newCboxId);
9318
+ }
9319
+ // TODO: to test the case of frozen columns
9320
+ }
9321
+ if($t.p.inlineData === undefined) { $t.p.inlineData ={}; }
9216
9322
  tmp = $.extend({},tmp,$t.p.inlineData,o.extraparam);
9217
9323
  }
9218
9324
  if (o.url == 'clientArray') {
@@ -9222,10 +9328,10 @@ $.jgrid.extend({
9222
9328
  tmp[n] = $.jgrid.htmlDecode(v);
9223
9329
  });
9224
9330
  }
9225
- var resp = $($t).jqGrid("setRowData",rowid,tmp);
9331
+ var k, resp = $($t).jqGrid("setRowData",rowid,tmp);
9226
9332
  $(ind).attr("editable","0");
9227
- for( var k=0;k<$t.p.savedRow.length;k++) {
9228
- if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
9333
+ for(k=0;k<$t.p.savedRow.length;k++) {
9334
+ if( $t.p.savedRow[k].id == oldRowId) {fr = k; break;}
9229
9335
  }
9230
9336
  if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
9231
9337
  $($t).triggerHandler("jqGridInlineAfterSaveRow", [rowid, resp, tmp, o]);
@@ -9244,14 +9350,14 @@ $.jgrid.extend({
9244
9350
  complete: function(res,stat){
9245
9351
  $("#lui_"+$.jgrid.jqID($t.p.id)).hide();
9246
9352
  if (stat === "success"){
9247
- var ret = true, sucret;
9353
+ var ret = true, sucret, k;
9248
9354
  sucret = $($t).triggerHandler("jqGridInlineSuccessSaveRow", [res, rowid, o]);
9249
9355
  if (!$.isArray(sucret)) {sucret = [true, tmp];}
9250
9356
  if (sucret[0] && $.isFunction(o.successfunc)) {sucret = o.successfunc.call($t, res);}
9251
9357
  if($.isArray(sucret)) {
9252
9358
  // expect array - status, data, rowid
9253
9359
  ret = sucret[0];
9254
- tmp = sucret[1] ? sucret[1] : tmp;
9360
+ tmp = sucret[1] || tmp;
9255
9361
  } else {
9256
9362
  ret = sucret;
9257
9363
  }
@@ -9264,7 +9370,7 @@ $.jgrid.extend({
9264
9370
  tmp = $.extend({},tmp, tmp2);
9265
9371
  $($t).jqGrid("setRowData",rowid,tmp);
9266
9372
  $(ind).attr("editable","0");
9267
- for( var k=0;k<$t.p.savedRow.length;k++) {
9373
+ for(k=0;k<$t.p.savedRow.length;k++) {
9268
9374
  if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
9269
9375
  }
9270
9376
  if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
@@ -9319,11 +9425,11 @@ $.jgrid.extend({
9319
9425
  // End compatible
9320
9426
 
9321
9427
  return this.each(function(){
9322
- var $t= this, fr, ind, ares={};
9428
+ var $t= this, fr, ind, ares={}, k;
9323
9429
  if (!$t.grid ) { return; }
9324
9430
  ind = $($t).jqGrid("getInd",rowid,true);
9325
9431
  if(ind === false) {return;}
9326
- for( var k=0;k<$t.p.savedRow.length;k++) {
9432
+ for(k=0;k<$t.p.savedRow.length;k++) {
9327
9433
  if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
9328
9434
  }
9329
9435
  if(fr >= 0) {
@@ -9333,7 +9439,7 @@ $.jgrid.extend({
9333
9439
  } catch (e) {}
9334
9440
  }
9335
9441
  $.each($t.p.colModel, function(){
9336
- if(this.editable === true && this.name in $t.p.savedRow[fr] ) {
9442
+ if(this.editable === true && $t.p.savedRow[fr].hasOwnProperty(this.name)) {
9337
9443
  ares[this.name] = $t.p.savedRow[fr][this.name];
9338
9444
  }
9339
9445
  });
@@ -9353,7 +9459,7 @@ $.jgrid.extend({
9353
9459
  },
9354
9460
  addRow : function ( p ) {
9355
9461
  p = $.extend(true, {
9356
- rowID : "new_row",
9462
+ rowID : null,
9357
9463
  initdata : {},
9358
9464
  position :"first",
9359
9465
  useDefValues : true,
@@ -9363,6 +9469,7 @@ $.jgrid.extend({
9363
9469
  return this.each(function(){
9364
9470
  if (!this.grid ) { return; }
9365
9471
  var $t = this;
9472
+ p.rowID = $.isFunction(p.rowID) ? p.rowID.call($t, p) : ( (p.rowID != null) ? p.rowID : $.jgrid.randId());
9366
9473
  if(p.useDefValues === true) {
9367
9474
  $($t.p.colModel).each(function(){
9368
9475
  if( this.editoptions && this.editoptions.defaultValue ) {
@@ -9396,7 +9503,7 @@ $.jgrid.extend({
9396
9503
  saveicon:"ui-icon-disk",
9397
9504
  cancel: true,
9398
9505
  cancelicon:"ui-icon-cancel",
9399
- addParams : {useFormatter : false,rowID : "new_row"},
9506
+ addParams : {},
9400
9507
  editParams : {},
9401
9508
  restoreAfterSelect : true
9402
9509
  }, $.jgrid.nav, o ||{});
@@ -9558,7 +9665,9 @@ $.jgrid.extend({
9558
9665
  //end inline edit
9559
9666
  });
9560
9667
  })(jQuery);
9561
- ;(function($){
9668
+ /*jshint evil:true, eqeqeq:false, eqnull:true, devel:true */
9669
+ /*global jQuery */
9670
+ (function($){
9562
9671
  /*
9563
9672
  **
9564
9673
  * jqGrid addons using jQuery UI
@@ -9568,6 +9677,7 @@ $.jgrid.extend({
9568
9677
  * http://www.gnu.org/licenses/gpl-2.0.html
9569
9678
  * depends on jQuery UI
9570
9679
  **/
9680
+ "use strict";
9571
9681
  if ($.browser.msie && $.browser.version==8) {
9572
9682
  $.expr[":"].hidden = function(elem) {
9573
9683
  return elem.offsetWidth === 0 || elem.offsetHeight === 0 ||
@@ -9580,17 +9690,17 @@ if($.ui) {
9580
9690
  if ($.ui.multiselect ) {
9581
9691
  if($.ui.multiselect.prototype._setSelected) {
9582
9692
  var setSelected = $.ui.multiselect.prototype._setSelected;
9583
- $.ui.multiselect.prototype._setSelected = function(item,selected) {
9584
- var ret = setSelected.call(this,item,selected);
9585
- if (selected && this.selectedList) {
9586
- var elt = this.element;
9587
- this.selectedList.find('li').each(function() {
9588
- if ($(this).data('optionLink')) {
9589
- $(this).data('optionLink').remove().appendTo(elt);
9590
- }
9591
- });
9592
- }
9593
- return ret;
9693
+ $.ui.multiselect.prototype._setSelected = function(item,selected) {
9694
+ var ret = setSelected.call(this,item,selected);
9695
+ if (selected && this.selectedList) {
9696
+ var elt = this.element;
9697
+ this.selectedList.find('li').each(function() {
9698
+ if ($(this).data('optionLink')) {
9699
+ $(this).data('optionLink').remove().appendTo(elt);
9700
+ }
9701
+ });
9702
+ }
9703
+ return ret;
9594
9704
  };
9595
9705
  }
9596
9706
  if($.ui.multiselect.prototype.destroy) {
@@ -9601,7 +9711,7 @@ if($.ui) {
9601
9711
  $.widget.prototype.destroy.apply(this, arguments);
9602
9712
  } else {
9603
9713
  $.Widget.prototype.destroy.apply(this, arguments);
9604
- }
9714
+ }
9605
9715
  };
9606
9716
  }
9607
9717
  $.jgrid._multiselect = true;
@@ -9640,7 +9750,7 @@ $.jgrid.extend({
9640
9750
  var permutation = [];
9641
9751
  th.each(function() {
9642
9752
  var id = $(">div", this).get(0).id.replace(/^jqgh_/, "").replace(tid,"");
9643
- if (id in cmMap) {
9753
+ if (cmMap.hasOwnProperty(id)) {
9644
9754
  permutation.push(cmMap[id]);
9645
9755
  }
9646
9756
  });
@@ -9729,8 +9839,8 @@ $.jgrid.extend({
9729
9839
  "close": function() {
9730
9840
  opts.cleanup(true);
9731
9841
  },
9732
- "modal" : opts.modal ? opts.modal : false,
9733
- "resizable": opts.resizable ? opts.resizable : true,
9842
+ "modal" : opts.modal || false,
9843
+ "resizable": opts.resizable || true,
9734
9844
  "width": opts.width+20
9735
9845
  }, opts.dialog_opts || {});
9736
9846
  },
@@ -9812,7 +9922,7 @@ $.jgrid.extend({
9812
9922
  }
9813
9923
 
9814
9924
  select.append("<option value='"+i+"' "+
9815
- (this.hidden?"":"selected='selected'")+">"+jQuery.jgrid.stripHtml(colNames[i])+"</option>");
9925
+ (this.hidden?"":"selected='selected'")+">"+$.jgrid.stripHtml(colNames[i])+"</option>");
9816
9926
  });
9817
9927
  function call(fn, obj) {
9818
9928
  if (!fn) { return; }
@@ -9885,7 +9995,7 @@ $.jgrid.extend({
9885
9995
  },
9886
9996
  gridDnD : function(opts) {
9887
9997
  return this.each(function(){
9888
- var $t = this;
9998
+ var $t = this, i, cn;
9889
9999
  if(!$t.grid) { return; }
9890
10000
  // Currently we disable a treeGrid drag and drop
9891
10001
  if($t.p.treeGrid) { return; }
@@ -9893,7 +10003,7 @@ $.jgrid.extend({
9893
10003
  function updateDnD ()
9894
10004
  {
9895
10005
  var datadnd = $.data($t,"dnd");
9896
- $("tr.jqgrow:not(.ui-draggable)",$t).draggable($.isFunction(datadnd.drag) ? datadnd.drag.call($($t),datadnd) : datadnd.drag);
10006
+ $("tr.jqgrow:not(.ui-draggable)",$t).draggable($.isFunction(datadnd.drag) ? datadnd.drag.call($($t),datadnd) : datadnd.drag);
9897
10007
  }
9898
10008
  var appender = "<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>";
9899
10009
  if($("#jqgrid_dnd")[0] === undefined) {
@@ -9908,9 +10018,10 @@ $.jgrid.extend({
9908
10018
  "drag" : function (opts) {
9909
10019
  return $.extend({
9910
10020
  start : function (ev, ui) {
10021
+ var i, subgid;
9911
10022
  // if we are in subgrid mode try to collapse the node
9912
10023
  if($t.p.subGrid) {
9913
- var subgid = $(ui.helper).attr("id");
10024
+ subgid = $(ui.helper).attr("id");
9914
10025
  try {
9915
10026
  $($t).jqGrid('collapseSubGridRow',subgid);
9916
10027
  } catch (e) {}
@@ -9918,7 +10029,7 @@ $.jgrid.extend({
9918
10029
  // hack
9919
10030
  // drag and drop does not insert tr in table, when the table has no rows
9920
10031
  // we try to insert new empty row on the target(s)
9921
- for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
10032
+ for (i=0;i<$.data($t,"dnd").connectWith.length;i++){
9922
10033
  if($($.data($t,"dnd").connectWith[i]).jqGrid('getGridParam','reccount') == "0" ){
9923
10034
  $($.data($t,"dnd").connectWith[i]).jqGrid('addRowData','jqg_empty_row',{});
9924
10035
  }
@@ -9930,13 +10041,14 @@ $.jgrid.extend({
9930
10041
  if(opts.onstart && $.isFunction(opts.onstart) ) { opts.onstart.call($($t),ev,ui); }
9931
10042
  },
9932
10043
  stop :function(ev,ui) {
10044
+ var i, ids;
9933
10045
  if(ui.helper.dropped && !opts.dragcopy) {
9934
- var ids = $(ui.helper).attr("id");
10046
+ ids = $(ui.helper).attr("id");
9935
10047
  if(ids === undefined) { ids = $(this).attr("id"); }
9936
10048
  $($t).jqGrid('delRowData',ids );
9937
10049
  }
9938
10050
  // if we have a empty row inserted from start event try to delete it
9939
- for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
10051
+ for (i=0;i<$.data($t,"dnd").connectWith.length;i++){
9940
10052
  $($.data($t,"dnd").connectWith[i]).jqGrid('delRowData','jqg_empty_row');
9941
10053
  }
9942
10054
  if(opts.onstop && $.isFunction(opts.onstop) ) { opts.onstop.call($($t),ev,ui); }
@@ -9949,8 +10061,8 @@ $.jgrid.extend({
9949
10061
  if (!$(d).hasClass('jqgrow')) { return d;}
9950
10062
  var tid = $(d).closest("table.ui-jqgrid-btable");
9951
10063
  if(tid.length > 0 && $.data(tid[0],"dnd") !== undefined) {
9952
- var cn = $.data(tid[0],"dnd").connectWith;
9953
- return $.inArray('#'+$.jgrid.jqID(this.id),cn) != -1 ? true : false;
10064
+ var cn = $.data(tid[0],"dnd").connectWith;
10065
+ return $.inArray('#'+$.jgrid.jqID(this.id),cn) != -1 ? true : false;
9954
10066
  }
9955
10067
  return false;
9956
10068
  },
@@ -9959,10 +10071,11 @@ $.jgrid.extend({
9959
10071
  var accept = $(ui.draggable).attr("id");
9960
10072
  var getdata = ui.draggable.parent().parent().jqGrid('getRowData',accept);
9961
10073
  if(!opts.dropbyname) {
9962
- var j =0, tmpdata = {}, nm;
10074
+ var j =0, tmpdata = {}, nm, key;
9963
10075
  var dropmodel = $("#"+$.jgrid.jqID(this.id)).jqGrid('getGridParam','colModel');
9964
10076
  try {
9965
- for (var key in getdata) {
10077
+ for (key in getdata) {
10078
+ if (getdata.hasOwnProperty(key)) {
9966
10079
  nm = dropmodel[j].name;
9967
10080
  if( !(nm == 'cb' || nm =='rn' || nm == 'subgrid' )) {
9968
10081
  if(getdata.hasOwnProperty(key) && dropmodel[j]) {
@@ -9971,6 +10084,7 @@ $.jgrid.extend({
9971
10084
  }
9972
10085
  j++;
9973
10086
  }
10087
+ }
9974
10088
  getdata = tmpdata;
9975
10089
  } catch (e) {}
9976
10090
  }
@@ -9979,7 +10093,7 @@ $.jgrid.extend({
9979
10093
  //parameters to this callback - event, element, data to be inserted, sender, reciever
9980
10094
  // should return object which will be inserted into the reciever
9981
10095
  var datatoinsert = opts.beforedrop.call(this,ev,ui,getdata,$('#'+$.jgrid.jqID($t.p.id)),$(this));
9982
- if (typeof datatoinsert != "undefined" && datatoinsert !== null && typeof datatoinsert == "object") { getdata = datatoinsert; }
10096
+ if (datatoinsert !== undefined && datatoinsert !== null && typeof datatoinsert == "object") { getdata = datatoinsert; }
9983
10097
  }
9984
10098
  if(ui.helper.dropped) {
9985
10099
  var grid;
@@ -10028,8 +10142,8 @@ $.jgrid.extend({
10028
10142
  updateDnD();
10029
10143
  }
10030
10144
  $t.p.jqgdnd = true;
10031
- for (var i=0;i<opts.connectWith.length;i++){
10032
- var cn =opts.connectWith[i];
10145
+ for (i=0;i<opts.connectWith.length;i++){
10146
+ cn =opts.connectWith[i];
10033
10147
  $(cn).droppable($.isFunction(opts.drop) ? opts.drop.call($($t),opts) : opts.drop);
10034
10148
  }
10035
10149
  });
@@ -10068,7 +10182,9 @@ $.jgrid.extend({
10068
10182
  }
10069
10183
  });
10070
10184
  })(jQuery);
10071
- ;(function($){
10185
+ /*jshint eqeqeq:false */
10186
+ /*global jQuery */
10187
+ (function($){
10072
10188
  /**
10073
10189
  * jqGrid extension for SubGrid Data
10074
10190
  * Tony Tomov tony@trirand.com
@@ -10081,7 +10197,7 @@ $.jgrid.extend({
10081
10197
  $.jgrid.extend({
10082
10198
  setSubGrid : function () {
10083
10199
  return this.each(function (){
10084
- var $t = this, cm,
10200
+ var $t = this, cm, i,
10085
10201
  suboptions = {
10086
10202
  plusicon : "ui-icon-plus",
10087
10203
  minusicon : "ui-icon-minus",
@@ -10093,11 +10209,11 @@ setSubGrid : function () {
10093
10209
  };
10094
10210
  $t.p.subGridOptions = $.extend(suboptions, $t.p.subGridOptions || {});
10095
10211
  $t.p.colNames.unshift("");
10096
- $t.p.colModel.unshift({name:'subgrid',width: $.browser.safari ? $t.p.subGridWidth+$t.p.cellLayout : $t.p.subGridWidth,sortable: false,resizable:false,hidedlg:true,search:false,fixed:true});
10212
+ $t.p.colModel.unshift({name:'subgrid',width: ($.browser.safari || $.browser.webkit) ? $t.p.subGridWidth+$t.p.cellLayout : $t.p.subGridWidth,sortable: false,resizable:false,hidedlg:true,search:false,fixed:true});
10097
10213
  cm = $t.p.subGridModel;
10098
10214
  if(cm[0]) {
10099
10215
  cm[0].align = $.extend([],cm[0].align || []);
10100
- for(var i=0;i<cm[0].name.length;i++) { cm[0].align[i] = cm[0].align[i] || 'left';}
10216
+ for(i=0;i<cm[0].name.length;i++) { cm[0].align[i] = cm[0].align[i] || 'left';}
10101
10217
  }
10102
10218
  });
10103
10219
  },
@@ -10170,7 +10286,7 @@ addSubGrid : function( pos, sind ) {
10170
10286
  if (sjxml){
10171
10287
  sgmap = ts.p.jsonReader.subgrid;
10172
10288
  result = $.jgrid.getAccessor(sjxml, sgmap.root);
10173
- if ( typeof result !== 'undefined' ) {
10289
+ if ( result !== undefined ) {
10174
10290
  for (i=0;i<result.length;i++) {
10175
10291
  cur = result[i];
10176
10292
  trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>");
@@ -10481,7 +10597,8 @@ jQuery(selector).each(function() {
10481
10597
  * http://www.gnu.org/licenses/gpl.html
10482
10598
  **/
10483
10599
 
10484
- /*global document, jQuery, $ */
10600
+ /*jshint eqeqeq:false */
10601
+ /*global jQuery */
10485
10602
  (function($) {
10486
10603
  "use strict";
10487
10604
  $.jgrid.extend({
@@ -10539,7 +10656,7 @@ $.jgrid.extend({
10539
10656
  ldat[isLeaf] = false;
10540
10657
  lf="";
10541
10658
  }
10542
- ldat[expanded] = ((ldat[expanded] == "true" || ldat[expanded] === true) ? true : false) && ldat[loaded];
10659
+ ldat[expanded] = ((ldat[expanded] == "true" || ldat[expanded] === true) ? true : false) && (ldat[loaded] || ldat[loaded] === undefined);
10543
10660
  if(ldat[expanded] === false) {
10544
10661
  twrap += ((ldat[isLeaf] === true) ? "'" : $t.p.treeIcons.plus+" tree-plus treeclick'");
10545
10662
  } else {
@@ -10601,7 +10718,7 @@ $.jgrid.extend({
10601
10718
  },
10602
10719
  setTreeGrid : function() {
10603
10720
  return this.each(function (){
10604
- var $t = this, i=0, pico, ecol = false, nm, key, dupcols=[];
10721
+ var $t = this, i=0, pico, ecol = false, nm, key, tkey, dupcols=[];
10605
10722
  if(!$t.p.treeGrid) {return;}
10606
10723
  if(!$t.p.treedatatype ) {$.extend($t.p,{treedatatype: $t.p.datatype});}
10607
10724
  $t.p.subGrid = false;$t.p.altRows =false;
@@ -10641,8 +10758,8 @@ $.jgrid.extend({
10641
10758
  }
10642
10759
  i++;
10643
10760
  //
10644
- for(var tkey in $t.p.treeReader) {
10645
- if($t.p.treeReader[tkey] == nm) {
10761
+ for(tkey in $t.p.treeReader) {
10762
+ if($t.p.treeReader.hasOwnProperty(tkey) && $t.p.treeReader[tkey] == nm) {
10646
10763
  dupcols.push(nm);
10647
10764
  }
10648
10765
  }
@@ -10984,7 +11101,7 @@ $.jgrid.extend({
10984
11101
  },
10985
11102
  delTreeNode : function (rowid) {
10986
11103
  return this.each(function () {
10987
- var $t = this, rid = $t.p.localReader.id,
11104
+ var $t = this, rid = $t.p.localReader.id, i,
10988
11105
  left = $t.p.treeReader.left_field,
10989
11106
  right = $t.p.treeReader.right_field, myright, width, res, key;
10990
11107
  if(!$t.grid || !$t.p.treeGrid) {return;}
@@ -10995,7 +11112,7 @@ $.jgrid.extend({
10995
11112
  width = myright - parseInt($t.p.data[rc][left],10) + 1;
10996
11113
  var dr = $($t).jqGrid("getFullTreeNode",$t.p.data[rc]);
10997
11114
  if(dr.length>0){
10998
- for (var i=0;i<dr.length;i++){
11115
+ for (i=0;i<dr.length;i++){
10999
11116
  $($t).jqGrid("delRowData",dr[i][rid]);
11000
11117
  }
11001
11118
  }
@@ -11025,7 +11142,7 @@ $.jgrid.extend({
11025
11142
  }
11026
11143
  });
11027
11144
  },
11028
- addChildNode : function( nodeid, parentid, data ) {
11145
+ addChildNode : function( nodeid, parentid, data, expandData ) {
11029
11146
  //return this.each(function(){
11030
11147
  var $t = this[0];
11031
11148
  if(data) {
@@ -11039,8 +11156,8 @@ $.jgrid.extend({
11039
11156
  right = $t.p.treeReader.right_field,
11040
11157
  loaded = $t.p.treeReader.loaded,
11041
11158
  method, parentindex, parentdata, parentlevel, i, len, max=0, rowind = parentid, leaf, maxright;
11042
-
11043
- if ( typeof nodeid === 'undefined' || nodeid === null ) {
11159
+ if(expandData===undefined) {expandData = false;}
11160
+ if ( nodeid === undefined || nodeid === null ) {
11044
11161
  i = $t.p.data.length-1;
11045
11162
  if( i>= 0 ) {
11046
11163
  while(i>=0){max = Math.max(max, parseInt($t.p.data[i][$t.p.localReader.id],10)); i--;}
@@ -11048,48 +11165,48 @@ $.jgrid.extend({
11048
11165
  nodeid = max+1;
11049
11166
  }
11050
11167
  var prow = $($t).jqGrid('getInd', parentid);
11051
- leaf = false;
11052
- // if not a parent we assume root
11053
- if ( parentid === undefined || parentid === null || parentid==="") {
11054
- parentid = null;
11055
- rowind = null;
11056
- method = 'last';
11057
- parentlevel = $t.p.tree_root_level;
11058
- i = $t.p.data.length+1;
11168
+ leaf = false;
11169
+ // if not a parent we assume root
11170
+ if ( parentid === undefined || parentid === null || parentid==="") {
11171
+ parentid = null;
11172
+ rowind = null;
11173
+ method = 'last';
11174
+ parentlevel = $t.p.tree_root_level;
11175
+ i = $t.p.data.length+1;
11176
+ } else {
11177
+ method = 'after';
11178
+ parentindex = $t.p._index[parentid];
11179
+ parentdata = $t.p.data[parentindex];
11180
+ parentid = parentdata[$t.p.localReader.id];
11181
+ parentlevel = parseInt(parentdata[level],10)+1;
11182
+ var childs = $($t).jqGrid('getFullTreeNode', parentdata);
11183
+ // if there are child nodes get the last index of it
11184
+ if(childs.length) {
11185
+ i = childs[childs.length-1][$t.p.localReader.id];
11186
+ rowind = i;
11187
+ i = $($t).jqGrid('getInd',rowind)+1;
11059
11188
  } else {
11060
- method = 'after';
11061
- parentindex = $t.p._index[parentid];
11062
- parentdata = $t.p.data[parentindex];
11063
- parentid = parentdata[$t.p.localReader.id];
11064
- parentlevel = parseInt(parentdata[level],10)+1;
11065
- var childs = $($t).jqGrid('getFullTreeNode', parentdata);
11066
- // if there are child nodes get the last index of it
11067
- if(childs.length) {
11068
- i = childs[childs.length-1][$t.p.localReader.id];
11069
- rowind = i;
11070
- i = $($t).jqGrid('getInd',rowind)+1;
11071
- } else {
11072
- i = $($t).jqGrid('getInd', parentid)+1;
11073
- }
11074
- // if the node is leaf
11075
- if(parentdata[isLeaf]) {
11076
- leaf = true;
11077
- parentdata[expanded] = true;
11078
- //var prow = $($t).jqGrid('getInd', parentid);
11079
- $($t.rows[prow])
11080
- .find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper")
11081
- .end()
11082
- .find("div.tree-leaf").removeClass($t.p.treeIcons.leaf+" tree-leaf").addClass($t.p.treeIcons.minus+" tree-minus");
11083
- $t.p.data[parentindex][isLeaf] = false;
11084
- parentdata[loaded] = true;
11085
- }
11189
+ i = $($t).jqGrid('getInd', parentid)+1;
11086
11190
  }
11087
- len = i+1;
11191
+ // if the node is leaf
11192
+ if(parentdata[isLeaf]) {
11193
+ leaf = true;
11194
+ parentdata[expanded] = true;
11195
+ //var prow = $($t).jqGrid('getInd', parentid);
11196
+ $($t.rows[prow])
11197
+ .find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper")
11198
+ .end()
11199
+ .find("div.tree-leaf").removeClass($t.p.treeIcons.leaf+" tree-leaf").addClass($t.p.treeIcons.minus+" tree-minus");
11200
+ $t.p.data[parentindex][isLeaf] = false;
11201
+ parentdata[loaded] = true;
11202
+ }
11203
+ }
11204
+ len = i+1;
11088
11205
 
11089
- data[expanded] = false;
11090
- data[loaded] = true;
11206
+ if( data[expanded]===undefined) {data[expanded]= false;}
11207
+ if( data[loaded]===undefined ) { data[loaded] = false;}
11091
11208
  data[level] = parentlevel;
11092
- data[isLeaf] = true;
11209
+ if( data[isLeaf]===undefined) {data[isLeaf]= true;}
11093
11210
  if( $t.p.treeGridModel === "adjacency") {
11094
11211
  data[parent] = parentid;
11095
11212
  }
@@ -11143,7 +11260,7 @@ $.jgrid.extend({
11143
11260
  $($t).jqGrid('addRowData', nodeid, data, method, rowind);
11144
11261
  $($t).jqGrid('setTreeNode', i, len);
11145
11262
  }
11146
- if(parentdata && !parentdata[expanded]) {
11263
+ if(parentdata && !parentdata[expanded] && expandData) {
11147
11264
  $($t.rows[prow])
11148
11265
  .find("div.treeclick")
11149
11266
  .click();
@@ -11269,7 +11386,7 @@ open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-i
11269
11386
  else o=F;
11270
11387
 
11271
11388
  h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
11272
- if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
11389
+ if(ie6){try{$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}catch(__){}}
11273
11390
 
11274
11391
  if(c.ajax) {var r=c.target||h.w,u=c.ajax;r=(typeof r == 'string')?$(r,h.w):$(r);u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
11275
11392
  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
@@ -11305,8 +11422,10 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11305
11422
  * http://www.gnu.org/licenses/gpl-2.0.html
11306
11423
  *
11307
11424
  **/
11425
+ /*jshint eqeqeq:false */
11426
+ /*global jQuery */
11308
11427
 
11309
- ;(function($) {
11428
+ (function($) {
11310
11429
  "use strict";
11311
11430
  $.fmatter = {};
11312
11431
  //opts can be id:row id for the row, rowdata:the data for the row, colmodel:the column model for this column
@@ -11328,7 +11447,7 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11328
11447
  return o === null;
11329
11448
  },
11330
11449
  isUndefined : function(o) {
11331
- return typeof o === 'undefined';
11450
+ return o === undefined;
11332
11451
  },
11333
11452
  isValue : function (o) {
11334
11453
  return (this.isObject(o) || this.isString(o) || this.isNumber(o) || this.isBoolean(o));
@@ -11336,7 +11455,8 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11336
11455
  isEmpty : function(o) {
11337
11456
  if(!this.isString(o) && this.isValue(o)) {
11338
11457
  return false;
11339
- }else if (!this.isValue(o)){
11458
+ }
11459
+ if (!this.isValue(o)){
11340
11460
  return true;
11341
11461
  }
11342
11462
  o = $.trim(o).replace(/\&nbsp\;/ig,'').replace(/\&#160\;/ig,'');
@@ -11361,14 +11481,14 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11361
11481
  }
11362
11482
  if($.fmatter.isNumber(nData)) {
11363
11483
  var bNegative = (nData < 0);
11364
- var sOutput = nData + "";
11365
- var sDecimalSeparator = (opts.decimalSeparator) ? opts.decimalSeparator : ".";
11484
+ var sOutput = String(nData);
11485
+ var sDecimalSeparator = opts.decimalSeparator || ".";
11366
11486
  var nDotIndex;
11367
11487
  if($.fmatter.isNumber(opts.decimalPlaces)) {
11368
11488
  // Round to the correct decimal place
11369
11489
  var nDecimalPlaces = opts.decimalPlaces;
11370
11490
  var nDecimal = Math.pow(10, nDecimalPlaces);
11371
- sOutput = Math.round(nData*nDecimal)/nDecimal + "";
11491
+ sOutput = String(Math.round(nData*nDecimal)/nDecimal);
11372
11492
  nDotIndex = sOutput.lastIndexOf(".");
11373
11493
  if(nDecimalPlaces > 0) {
11374
11494
  // Add the decimal separator
@@ -11391,8 +11511,8 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11391
11511
  nDotIndex = sOutput.lastIndexOf(sDecimalSeparator);
11392
11512
  nDotIndex = (nDotIndex > -1) ? nDotIndex : sOutput.length;
11393
11513
  var sNewOutput = sOutput.substring(nDotIndex);
11394
- var nCount = -1;
11395
- for (var i=nDotIndex; i>0; i--) {
11514
+ var nCount = -1, i;
11515
+ for (i=nDotIndex; i>0; i--) {
11396
11516
  nCount++;
11397
11517
  if ((nCount%3 === 0) && (i !== nDotIndex) && (!bNegative || (i > 1))) {
11398
11518
  sNewOutput = sThousandsSeparator + sNewOutput;
@@ -11407,9 +11527,8 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11407
11527
  sOutput = (opts.suffix) ? sOutput + opts.suffix : sOutput;
11408
11528
  return sOutput;
11409
11529
 
11410
- } else {
11411
- return nData;
11412
11530
  }
11531
+ return nData;
11413
11532
  },
11414
11533
  // Tony Tomov
11415
11534
  // PHP implementation. Sorry not all options are supported.
@@ -11434,7 +11553,7 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11434
11553
  dayNames: opts.dayNames,
11435
11554
  monthNames: opts.monthNames
11436
11555
  };
11437
- if( format in opts.masks ) { format = opts.masks[format]; }
11556
+ if( opts.masks.hasOwnProperty(format) ) { format = opts.masks[format]; }
11438
11557
  if( !isNaN( date - 0 ) && String(format).toLowerCase() == "u") {
11439
11558
  //Unix timestamp
11440
11559
  timestamp = new Date( parseFloat(date)*1000 );
@@ -11477,7 +11596,7 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11477
11596
  timestamp = new Date(ts.y, ts.m, ts.d, ts.h, ts.i, ts.s, ts.u);
11478
11597
  }
11479
11598
 
11480
- if( newformat in opts.masks ) {
11599
+ if( opts.masks.hasOwnProperty(newformat) ) {
11481
11600
  newformat = opts.masks[newformat];
11482
11601
  } else if ( !newformat ) {
11483
11602
  newformat = 'Y-m-d';
@@ -11542,19 +11661,18 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11542
11661
  U: Math.floor(timestamp / 1000)
11543
11662
  };
11544
11663
  return newformat.replace(token, function ($0) {
11545
- return $0 in flags ? flags[$0] : $0.substring(1);
11664
+ return flags.hasOwnProperty($0) ? flags[$0] : $0.substring(1);
11546
11665
  });
11547
11666
  }
11548
11667
  };
11549
11668
  $.fn.fmatter.defaultFormat = function(cellval, opts) {
11550
- return ($.fmatter.isValue(cellval) && cellval!=="" ) ? cellval : opts.defaultValue ? opts.defaultValue : "&#160;";
11669
+ return ($.fmatter.isValue(cellval) && cellval!=="" ) ? cellval : opts.defaultValue || "&#160;";
11551
11670
  };
11552
11671
  $.fn.fmatter.email = function(cellval, opts) {
11553
11672
  if(!$.fmatter.isEmpty(cellval)) {
11554
11673
  return "<a href=\"mailto:" + cellval + "\">" + cellval + "</a>";
11555
- }else {
11556
- return $.fn.fmatter.defaultFormat(cellval,opts );
11557
11674
  }
11675
+ return $.fn.fmatter.defaultFormat(cellval,opts );
11558
11676
  };
11559
11677
  $.fn.fmatter.checkbox =function(cval, opts) {
11560
11678
  var op = $.extend({},opts.checkbox), ds;
@@ -11563,8 +11681,9 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11563
11681
  }
11564
11682
  if(op.disabled===true) {ds = "disabled=\"disabled\"";} else {ds="";}
11565
11683
  if($.fmatter.isEmpty(cval) || $.fmatter.isUndefined(cval) ) {cval = $.fn.fmatter.defaultFormat(cval,op);}
11566
- cval=cval+"";cval=cval.toLowerCase();
11567
- var bchk = cval.search(/(false|0|no|off)/i)<0 ? " checked='checked' " : "";
11684
+ cval=String(cval);
11685
+ cval=cval.toLowerCase();
11686
+ var bchk = cval.search(/(false|0|no|n|off)/i)<0 ? " checked='checked' " : "";
11568
11687
  return "<input type=\"checkbox\" " + bchk + " value=\""+ cval+"\" offval=\"no\" "+ds+ "/>";
11569
11688
  };
11570
11689
  $.fn.fmatter.link = function(cellval, opts) {
@@ -11576,9 +11695,8 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11576
11695
  if(op.target) {target = 'target=' + op.target;}
11577
11696
  if(!$.fmatter.isEmpty(cellval)) {
11578
11697
  return "<a "+target+" href=\"" + cellval + "\">" + cellval + "</a>";
11579
- }else {
11580
- return $.fn.fmatter.defaultFormat(cellval,opts);
11581
11698
  }
11699
+ return $.fn.fmatter.defaultFormat(cellval,opts);
11582
11700
  };
11583
11701
  $.fn.fmatter.showlink = function(cellval, opts) {
11584
11702
  var op = {baseLinkUrl: opts.baseLinkUrl,showAction:opts.showAction, addParam: opts.addParam || "", target: opts.target, idName: opts.idName},
@@ -11590,9 +11708,8 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11590
11708
  idUrl = op.baseLinkUrl+op.showAction + '?'+ op.idName+'='+opts.rowId+op.addParam;
11591
11709
  if($.fmatter.isString(cellval) || $.fmatter.isNumber(cellval)) { //add this one even if its blank string
11592
11710
  return "<a "+target+" href=\"" + idUrl + "\">" + cellval + "</a>";
11593
- }else {
11594
- return $.fn.fmatter.defaultFormat(cellval,opts);
11595
11711
  }
11712
+ return $.fn.fmatter.defaultFormat(cellval,opts);
11596
11713
  };
11597
11714
  $.fn.fmatter.integer = function(cellval, opts) {
11598
11715
  var op = $.extend({},opts.integer);
@@ -11631,15 +11748,15 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11631
11748
  }
11632
11749
  if(!op.reformatAfterEdit && act=='edit'){
11633
11750
  return $.fn.fmatter.defaultFormat(cellval, opts);
11634
- } else if(!$.fmatter.isEmpty(cellval)) {
11635
- return $.fmatter.util.DateFormat(op.srcformat,cellval,op.newformat,op);
11636
- } else {
11637
- return $.fn.fmatter.defaultFormat(cellval, opts);
11638
11751
  }
11752
+ if(!$.fmatter.isEmpty(cellval)) {
11753
+ return $.fmatter.util.DateFormat(op.srcformat,cellval,op.newformat,op);
11754
+ }
11755
+ return $.fn.fmatter.defaultFormat(cellval, opts);
11639
11756
  };
11640
11757
  $.fn.fmatter.select = function (cellval,opts) {
11641
11758
  // jqGrid specific
11642
- cellval = cellval + "";
11759
+ cellval = String(cellval);
11643
11760
  var oSelect = false, ret=[], sep, delim;
11644
11761
  if(!$.fmatter.isUndefined(opts.colModel.formatoptions)){
11645
11762
  oSelect= opts.colModel.formatoptions.value;
@@ -11656,8 +11773,8 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11656
11773
  if(msl) {scell = cellval.split(",");scell = $.map(scell,function(n){return $.trim(n);});}
11657
11774
  if ($.fmatter.isString(oSelect)) {
11658
11775
  // mybe here we can use some caching with care ????
11659
- var so = oSelect.split(delim), j=0;
11660
- for(var i=0; i<so.length;i++){
11776
+ var so = oSelect.split(delim), j=0, i;
11777
+ for(i=0; i<so.length;i++){
11661
11778
  sv = so[i].split(sep);
11662
11779
  if(sv.length > 2 ) {
11663
11780
  sv[1] = $.map(sv,function(n,i){if(i>0) {return n;}}).join(sep);
@@ -11686,51 +11803,53 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11686
11803
  cellval = ret.join(", ");
11687
11804
  return cellval === "" ? $.fn.fmatter.defaultFormat(cellval,opts) : cellval;
11688
11805
  };
11689
- $.fn.fmatter.rowactions = function(rid,gid,act,pos) {
11690
- var op ={
11691
- keys:false,
11692
- onEdit : null,
11693
- onSuccess: null,
11694
- afterSave:null,
11695
- onError: null,
11696
- afterRestore: null,
11697
- extraparam: {},
11698
- url: null,
11699
- restoreAfterError: true,
11700
- mtype: "POST",
11701
- delOptions: {},
11702
- editOptions : {}
11703
- };
11704
- rid = $.jgrid.jqID( rid );
11705
- gid = $.jgrid.jqID( gid );
11706
- var cm = $('#'+gid)[0].p.colModel[pos];
11707
- if(!$.fmatter.isUndefined(cm.formatoptions)) {
11806
+ $.fn.fmatter.rowactions = function(act) {
11807
+ var $tr = $(this).closest("tr.jqgrow"),
11808
+ $actionsDiv = $(this).parent(),
11809
+ rid = $tr.attr("id"),
11810
+ $grid = $(this).closest("table.ui-jqgrid-btable"),
11811
+ $t = $grid[0],
11812
+ p = $t.p,
11813
+ cm = p.colModel[$.jgrid.getCellIndex(this)],
11814
+ op = {
11815
+ keys: false,
11816
+ onEdit: null,
11817
+ onSuccess: null,
11818
+ afterSave: null,
11819
+ onError: null,
11820
+ afterRestore: null,
11821
+ extraparam: {},
11822
+ url: null,
11823
+ restoreAfterError: true,
11824
+ mtype: "POST",
11825
+ delOptions: {},
11826
+ editOptions: {}
11827
+ },
11828
+ saverow = function(rowid, res) {
11829
+ if($.isFunction(op.afterSave)) { op.afterSave.call($t, rowid, res); }
11830
+ $actionsDiv.find("div.ui-inline-edit,div.ui-inline-del").show();
11831
+ $actionsDiv.find("div.ui-inline-save,div.ui-inline-cancel").hide();
11832
+ },
11833
+ restorerow = function(rowid) {
11834
+ if($.isFunction(op.afterRestore)) { op.afterRestore.call($t, rowid); }
11835
+ $actionsDiv.find("div.ui-inline-edit,div.ui-inline-del").show();
11836
+ $actionsDiv.find("div.ui-inline-save,div.ui-inline-cancel").hide();
11837
+ };
11838
+
11839
+ if (!$.fmatter.isUndefined(cm.formatoptions)) {
11708
11840
  op = $.extend(op,cm.formatoptions);
11709
11841
  }
11710
- if( !$.fmatter.isUndefined($('#'+gid)[0].p.editOptions) ) {
11711
- op.editOptions = $('#'+gid)[0].p.editOptions;
11842
+ if (!$.fmatter.isUndefined(p.editOptions)) {
11843
+ op.editOptions = p.editOptions;
11712
11844
  }
11713
- if( !$.fmatter.isUndefined($('#'+gid)[0].p.delOptions) ) {
11714
- op.delOptions = $('#'+gid)[0].p.delOptions;
11845
+ if (!$.fmatter.isUndefined(p.delOptions)) {
11846
+ op.delOptions = p.delOptions;
11715
11847
  }
11716
- var $t = $("#"+gid)[0];
11717
- var saverow = function( rowid, res) {
11718
- if($.isFunction(op.afterSave)) { op.afterSave.call($t, rowid, res); }
11719
- $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid + ".ui-jqgrid-btable:first").show();
11720
- $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
11721
- },
11722
- restorerow = function( rowid) {
11723
- if($.isFunction(op.afterRestore) ) { op.afterRestore.call($t, rowid); }
11724
- $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show();
11725
- $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
11726
- };
11727
- if( $("#"+rid,"#"+gid).hasClass("jqgrid-new-row") ){
11728
- var opers = $t.p.prmNames,
11729
- oper = opers.oper;
11730
- op.extraparam[oper] = opers.addoper;
11848
+ if ($tr.hasClass("jqgrid-new-row")){
11849
+ op.extraparam[p.prmNames.oper] = p.prmNames.addoper;
11731
11850
  }
11732
11851
  var actop = {
11733
- keys : op.keys,
11852
+ keys: op.keys,
11734
11853
  oneditfunc: op.onEdit,
11735
11854
  successfunc: op.onSuccess,
11736
11855
  url: op.url,
@@ -11744,55 +11863,55 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11744
11863
  switch(act)
11745
11864
  {
11746
11865
  case 'edit':
11747
- $('#'+gid).jqGrid('editRow', rid, actop);
11748
- $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").hide();
11749
- $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").show();
11750
- $($t).triggerHandler("jqGridAfterGridComplete");
11866
+ $grid.jqGrid('editRow', rid, actop);
11867
+ $actionsDiv.find("div.ui-inline-edit,div.ui-inline-del").hide();
11868
+ $actionsDiv.find("div.ui-inline-save,div.ui-inline-cancel").show();
11869
+ $grid.triggerHandler("jqGridAfterGridComplete");
11751
11870
  break;
11752
11871
  case 'save':
11753
- if ( $('#'+gid).jqGrid('saveRow', rid, actop) ) {
11754
- $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show();
11755
- $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
11756
- $($t).triggerHandler("jqGridAfterGridComplete");
11872
+ if ($grid.jqGrid('saveRow', rid, actop)) {
11873
+ $actionsDiv.find("div.ui-inline-edit,div.ui-inline-del").show();
11874
+ $actionsDiv.find("div.ui-inline-save,div.ui-inline-cancel").hide();
11875
+ $grid.triggerHandler("jqGridAfterGridComplete");
11757
11876
  }
11758
11877
  break;
11759
11878
  case 'cancel' :
11760
- $('#'+gid).jqGrid('restoreRow',rid, restorerow);
11761
- $("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid+ ".ui-jqgrid-btable:first").show();
11762
- $("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid+ ".ui-jqgrid-btable:first").hide();
11763
- $($t).triggerHandler("jqGridAfterGridComplete");
11879
+ $grid.jqGrid('restoreRow', rid, restorerow);
11880
+ $actionsDiv.find("div.ui-inline-edit,div.ui-inline-del").show();
11881
+ $actionsDiv.find("div.ui-inline-save,div.ui-inline-cancel").hide();
11882
+ $grid.triggerHandler("jqGridAfterGridComplete");
11764
11883
  break;
11765
11884
  case 'del':
11766
- $('#'+gid).jqGrid('delGridRow',rid, op.delOptions);
11885
+ $grid.jqGrid('delGridRow', rid, op.delOptions);
11767
11886
  break;
11768
11887
  case 'formedit':
11769
- $('#'+gid).jqGrid('setSelection',rid);
11770
- $('#'+gid).jqGrid('editGridRow',rid, op.editOptions);
11888
+ $grid.jqGrid('setSelection', rid);
11889
+ $grid.jqGrid('editGridRow', rid, op.editOptions);
11771
11890
  break;
11772
11891
  }
11773
11892
  };
11774
11893
  $.fn.fmatter.actions = function(cellval,opts) {
11775
- var op ={keys:false, editbutton:true, delbutton:true, editformbutton: false};
11894
+ var op={keys:false, editbutton:true, delbutton:true, editformbutton: false},
11895
+ rowid=opts.rowId, str="",ocl;
11776
11896
  if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
11777
11897
  op = $.extend(op,opts.colModel.formatoptions);
11778
11898
  }
11779
- var rowid = opts.rowId, str="",ocl;
11780
- if(typeof(rowid) =='undefined' || $.fmatter.isEmpty(rowid)) {return "";}
11899
+ if(rowid === undefined || $.fmatter.isEmpty(rowid)) {return "";}
11781
11900
  if(op.editformbutton){
11782
- ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','formedit',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
11783
- str =str+ "<div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>";
11901
+ ocl = "onclick=jQuery.fn.fmatter.rowactions.call(this,'formedit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
11902
+ str += "<div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>";
11784
11903
  } else if(op.editbutton){
11785
- ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','edit',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ";
11786
- str =str+ "<div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>";
11904
+ ocl = "onclick=jQuery.fn.fmatter.rowactions.call(this,'edit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ";
11905
+ str += "<div title='"+$.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+ocl+"><span class='ui-icon ui-icon-pencil'></span></div>";
11787
11906
  }
11788
11907
  if(op.delbutton) {
11789
- ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','del',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
11790
- str = str+"<div title='"+$.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+ocl+"><span class='ui-icon ui-icon-trash'></span></div>";
11908
+ ocl = "onclick=jQuery.fn.fmatter.rowactions.call(this,'del'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
11909
+ str += "<div title='"+$.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+ocl+"><span class='ui-icon ui-icon-trash'></span></div>";
11791
11910
  }
11792
- ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','save',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
11793
- str = str+"<div title='"+$.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+ocl+"><span class='ui-icon ui-icon-disk'></span></div>";
11794
- ocl = "onclick=jQuery.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','cancel',"+opts.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
11795
- str = str+"<div title='"+$.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+ocl+"><span class='ui-icon ui-icon-cancel'></span></div>";
11911
+ ocl = "onclick=jQuery.fn.fmatter.rowactions.call(this,'save'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
11912
+ str += "<div title='"+$.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+ocl+"><span class='ui-icon ui-icon-disk'></span></div>";
11913
+ ocl = "onclick=jQuery.fn.fmatter.rowactions.call(this,'cancel'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
11914
+ str += "<div title='"+$.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+ocl+"><span class='ui-icon ui-icon-cancel'></span></div>";
11796
11915
  return "<div style='margin-left:8px;'>" + str + "</div>";
11797
11916
  };
11798
11917
  $.unformat = function (cellval,options,pos,cnt) {
@@ -11801,7 +11920,7 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11801
11920
  op =options.colModel.formatoptions || {}, sep,
11802
11921
  re = /([\.\*\_\'\(\)\{\}\+\?\\])/g,
11803
11922
  unformatFunc = options.colModel.unformat||($.fn.fmatter[formatType] && $.fn.fmatter[formatType].unformat);
11804
- if(typeof unformatFunc !== 'undefined' && $.isFunction(unformatFunc) ) {
11923
+ if(unformatFunc !== undefined && $.isFunction(unformatFunc) ) {
11805
11924
  ret = unformatFunc.call(this, $(cellval).text(), options, cellval);
11806
11925
  } else if(!$.fmatter.isUndefined(formatType) && $.fmatter.isString(formatType) ) {
11807
11926
  var opts = $.jgrid.formatter || {}, stripTag;
@@ -11862,8 +11981,8 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11862
11981
  scell = [], sv;
11863
11982
  if(msl) {scell = cell.split(",");scell = $.map(scell,function(n){return $.trim(n);});}
11864
11983
  if ($.fmatter.isString(oSelect)) {
11865
- var so = oSelect.split(delim), j=0;
11866
- for(var i=0; i<so.length;i++){
11984
+ var so = oSelect.split(delim), j=0, i;
11985
+ for(i=0; i<so.length;i++){
11867
11986
  sv = so[i].split(sep);
11868
11987
  if(sv.length > 2 ) {
11869
11988
  sv[1] = $.map(sv,function(n,i){if(i>0) {return n;}}).join(sep);
@@ -11888,13 +12007,12 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11888
12007
  return false;
11889
12008
  }
11890
12009
  });
11891
- if( typeof(rv) != 'undefined' ) {return rv;}
12010
+ if( rv !== undefined ) {return rv;}
11892
12011
  });
11893
12012
  }
11894
12013
  return ret.join(", ");
11895
- } else {
11896
- return cell || "";
11897
12014
  }
12015
+ return cell || "";
11898
12016
  };
11899
12017
  $.unformat.date = function (cellval, opts) {
11900
12018
  var op = $.jgrid.formatter.date || {};
@@ -11903,9 +12021,8 @@ hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function()
11903
12021
  }
11904
12022
  if(!$.fmatter.isEmpty(cellval)) {
11905
12023
  return $.fmatter.util.DateFormat(op.newformat,cellval,op.srcformat,op);
11906
- } else {
11907
- return $.fn.fmatter.defaultFormat(cellval, opts);
11908
12024
  }
12025
+ return $.fn.fmatter.defaultFormat(cellval, opts);
11909
12026
  };
11910
12027
  })(jQuery);
11911
12028
  /*