rails_jq_grid 0.0.3.pre2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/public/javascripts/rails-jqgrid/Changes.txt +0 -0
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-bg.js +132 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-bg1251.js +132 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-cat.js +128 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-cn.js +132 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-cs.js +128 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-da.js +128 -0
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-de.js +133 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-el.js +126 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-en.js +128 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-es.js +128 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-fa.js +145 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-fi.js +130 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-fr.js +126 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-gl.js +126 -0
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-he.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-hu.js +129 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-is.js +126 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-it.js +1 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-ja.js +155 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-nl.js +149 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-no.js +1 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-pl.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-pt-br.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-pt.js +125 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-ro.js +139 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-ru.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-sk.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-sr.js +128 -0
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-sv.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-tr.js +126 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-ua.js +127 -1
- data/public/javascripts/rails-jqgrid/install.txt +0 -0
- data/public/javascripts/rails-jqgrid/jquery.jqGrid.min.js +445 -432
- data/public/javascripts/rails-jqgrid/src/JsonXml.js +329 -329
- data/public/javascripts/rails-jqgrid/src/css/ellipsis-xbl.xml +0 -0
- data/public/javascripts/rails-jqgrid/src/css/ui.jqgrid.css +139 -129
- data/public/javascripts/rails-jqgrid/src/css/ui.multiselect.css +0 -0
- data/public/javascripts/rails-jqgrid/src/grid.base.js +3078 -3003
- data/public/javascripts/rails-jqgrid/src/grid.celledit.js +486 -486
- data/public/javascripts/rails-jqgrid/src/grid.common.js +646 -636
- data/public/javascripts/rails-jqgrid/src/grid.custom.js +820 -817
- data/public/javascripts/rails-jqgrid/src/grid.formedit.js +1954 -1872
- data/public/javascripts/rails-jqgrid/src/grid.grouping.js +250 -0
- data/public/javascripts/rails-jqgrid/src/grid.import.js +200 -200
- data/public/javascripts/rails-jqgrid/src/grid.inlinedit.js +255 -250
- data/public/javascripts/rails-jqgrid/src/grid.jqueryui.js +504 -503
- data/public/javascripts/rails-jqgrid/src/grid.loader.js +1 -0
- data/public/javascripts/rails-jqgrid/src/grid.postext.js +63 -63
- data/public/javascripts/rails-jqgrid/src/grid.setcolumns.js +125 -125
- data/public/javascripts/rails-jqgrid/src/grid.subgrid.js +260 -260
- data/public/javascripts/rails-jqgrid/src/grid.tbltogrid.js +106 -106
- data/public/javascripts/rails-jqgrid/src/grid.treegrid.js +489 -482
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-bg.js +132 -132
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-bg1251.js +132 -132
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-cat.js +128 -128
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-cn.js +132 -132
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-cs.js +128 -128
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-da.js +128 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-de.js +132 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-dk.js +0 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-el.js +126 -126
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-en.js +128 -128
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-es.js +128 -128
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-fa.js +145 -125
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-fi.js +130 -130
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-fr.js +2 -2
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-gl.js +126 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-he.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-hu.js +129 -129
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-is.js +126 -126
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-it.js +0 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ja.js +155 -155
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-nl.js +148 -148
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-no.js +0 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-pl.js +126 -126
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-pt-br.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-pt.js +125 -125
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ro.js +139 -139
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ru.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-sk.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-sr.js +128 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-sv.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-tr.js +126 -126
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ua.js +127 -127
- data/public/javascripts/rails-jqgrid/src/jqDnR.js +68 -67
- data/public/javascripts/rails-jqgrid/src/jqModal.js +68 -68
- data/public/javascripts/rails-jqgrid/src/jquery.fmatter.js +563 -541
- data/public/javascripts/rails-jqgrid/src/jquery.searchFilter.js +1 -1
- data/public/javascripts/rails-jqgrid/src/ui.multiselect.js +0 -0
- data/public/stylesheets/rails-jqgrid/ellipsis-xbl.xml +0 -0
- data/public/stylesheets/rails-jqgrid/ui.jqgrid.css +139 -2
- data/rails_jq_grid.gemspec +10 -3
- metadata +15 -11
@@ -1,542 +1,564 @@
|
|
1
|
-
/*
|
2
|
-
**
|
3
|
-
* formatter for values but most of the values if for jqGrid
|
4
|
-
* Some of this was inspired and based on how YUI does the table datagrid but in jQuery fashion
|
5
|
-
* we are trying to keep it as light as possible
|
6
|
-
* Joshua Burnett josh@9ci.com
|
7
|
-
* http://www.greenbill.com
|
8
|
-
*
|
9
|
-
* Changes from Tony Tomov tony@trirand.com
|
10
|
-
* Dual licensed under the MIT and GPL licenses:
|
11
|
-
* http://www.opensource.org/licenses/mit-license.php
|
12
|
-
* http://www.gnu.org/licenses/gpl-2.0.html
|
13
|
-
*
|
14
|
-
**/
|
15
|
-
|
16
|
-
;(function($) {
|
17
|
-
$.fmatter = {};
|
18
|
-
//opts can be id:row id for the row, rowdata:the data for the row, colmodel:the column model for this column
|
19
|
-
//example {id:1234,}
|
20
|
-
$.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
//
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
if(
|
283
|
-
|
284
|
-
}
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
}
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
1
|
+
/*
|
2
|
+
**
|
3
|
+
* formatter for values but most of the values if for jqGrid
|
4
|
+
* Some of this was inspired and based on how YUI does the table datagrid but in jQuery fashion
|
5
|
+
* we are trying to keep it as light as possible
|
6
|
+
* Joshua Burnett josh@9ci.com
|
7
|
+
* http://www.greenbill.com
|
8
|
+
*
|
9
|
+
* Changes from Tony Tomov tony@trirand.com
|
10
|
+
* Dual licensed under the MIT and GPL licenses:
|
11
|
+
* http://www.opensource.org/licenses/mit-license.php
|
12
|
+
* http://www.gnu.org/licenses/gpl-2.0.html
|
13
|
+
*
|
14
|
+
**/
|
15
|
+
|
16
|
+
;(function($) {
|
17
|
+
$.fmatter = {};
|
18
|
+
//opts can be id:row id for the row, rowdata:the data for the row, colmodel:the column model for this column
|
19
|
+
//example {id:1234,}
|
20
|
+
$.extend($.fmatter,{
|
21
|
+
isBoolean : function(o) {
|
22
|
+
return typeof o === 'boolean';
|
23
|
+
},
|
24
|
+
isObject : function(o) {
|
25
|
+
return (o && (typeof o === 'object' || $.isFunction(o))) || false;
|
26
|
+
},
|
27
|
+
isString : function(o) {
|
28
|
+
return typeof o === 'string';
|
29
|
+
},
|
30
|
+
isNumber : function(o) {
|
31
|
+
return typeof o === 'number' && isFinite(o);
|
32
|
+
},
|
33
|
+
isNull : function(o) {
|
34
|
+
return o === null;
|
35
|
+
},
|
36
|
+
isUndefined : function(o) {
|
37
|
+
return typeof o === 'undefined';
|
38
|
+
},
|
39
|
+
isValue : function (o) {
|
40
|
+
return (this.isObject(o) || this.isString(o) || this.isNumber(o) || this.isBoolean(o));
|
41
|
+
},
|
42
|
+
isEmpty : function(o) {
|
43
|
+
if(!this.isString(o) && this.isValue(o)) {
|
44
|
+
return false;
|
45
|
+
}else if (!this.isValue(o)){
|
46
|
+
return true;
|
47
|
+
}
|
48
|
+
o = $.trim(o).replace(/\ \;/ig,'').replace(/\ \;/ig,'');
|
49
|
+
return o==="";
|
50
|
+
}
|
51
|
+
});
|
52
|
+
$.fn.fmatter = function(formatType, cellval, opts, rwd, act) {
|
53
|
+
// build main options before element iteration
|
54
|
+
var v=cellval;
|
55
|
+
opts = $.extend({}, $.jgrid.formatter, opts);
|
56
|
+
|
57
|
+
if ($.fn.fmatter[formatType]){
|
58
|
+
v = $.fn.fmatter[formatType](cellval, opts, rwd, act);
|
59
|
+
}
|
60
|
+
return v;
|
61
|
+
};
|
62
|
+
$.fmatter.util = {
|
63
|
+
// Taken from YAHOO utils
|
64
|
+
NumberFormat : function(nData,opts) {
|
65
|
+
if(!$.fmatter.isNumber(nData)) {
|
66
|
+
nData *= 1;
|
67
|
+
}
|
68
|
+
if($.fmatter.isNumber(nData)) {
|
69
|
+
var bNegative = (nData < 0);
|
70
|
+
var sOutput = nData + "";
|
71
|
+
var sDecimalSeparator = (opts.decimalSeparator) ? opts.decimalSeparator : ".";
|
72
|
+
var nDotIndex;
|
73
|
+
if($.fmatter.isNumber(opts.decimalPlaces)) {
|
74
|
+
// Round to the correct decimal place
|
75
|
+
var nDecimalPlaces = opts.decimalPlaces;
|
76
|
+
var nDecimal = Math.pow(10, nDecimalPlaces);
|
77
|
+
sOutput = Math.round(nData*nDecimal)/nDecimal + "";
|
78
|
+
nDotIndex = sOutput.lastIndexOf(".");
|
79
|
+
if(nDecimalPlaces > 0) {
|
80
|
+
// Add the decimal separator
|
81
|
+
if(nDotIndex < 0) {
|
82
|
+
sOutput += sDecimalSeparator;
|
83
|
+
nDotIndex = sOutput.length-1;
|
84
|
+
}
|
85
|
+
// Replace the "."
|
86
|
+
else if(sDecimalSeparator !== "."){
|
87
|
+
sOutput = sOutput.replace(".",sDecimalSeparator);
|
88
|
+
}
|
89
|
+
// Add missing zeros
|
90
|
+
while((sOutput.length - 1 - nDotIndex) < nDecimalPlaces) {
|
91
|
+
sOutput += "0";
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
if(opts.thousandsSeparator) {
|
96
|
+
var sThousandsSeparator = opts.thousandsSeparator;
|
97
|
+
nDotIndex = sOutput.lastIndexOf(sDecimalSeparator);
|
98
|
+
nDotIndex = (nDotIndex > -1) ? nDotIndex : sOutput.length;
|
99
|
+
var sNewOutput = sOutput.substring(nDotIndex);
|
100
|
+
var nCount = -1;
|
101
|
+
for (var i=nDotIndex; i>0; i--) {
|
102
|
+
nCount++;
|
103
|
+
if ((nCount%3 === 0) && (i !== nDotIndex) && (!bNegative || (i > 1))) {
|
104
|
+
sNewOutput = sThousandsSeparator + sNewOutput;
|
105
|
+
}
|
106
|
+
sNewOutput = sOutput.charAt(i-1) + sNewOutput;
|
107
|
+
}
|
108
|
+
sOutput = sNewOutput;
|
109
|
+
}
|
110
|
+
// Prepend prefix
|
111
|
+
sOutput = (opts.prefix) ? opts.prefix + sOutput : sOutput;
|
112
|
+
// Append suffix
|
113
|
+
sOutput = (opts.suffix) ? sOutput + opts.suffix : sOutput;
|
114
|
+
return sOutput;
|
115
|
+
|
116
|
+
} else {
|
117
|
+
return nData;
|
118
|
+
}
|
119
|
+
},
|
120
|
+
// Tony Tomov
|
121
|
+
// PHP implementation. Sorry not all options are supported.
|
122
|
+
// Feel free to add them if you want
|
123
|
+
DateFormat : function (format, date, newformat, opts) {
|
124
|
+
var token = /\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
|
125
|
+
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
|
126
|
+
timezoneClip = /[^-+\dA-Z]/g,
|
127
|
+
msDateRegExp = new RegExp("^/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)/$"),
|
128
|
+
msMatch = date.match(msDateRegExp),
|
129
|
+
pad = function (value, length) {
|
130
|
+
value = String(value);
|
131
|
+
length = parseInt(length,10) || 2;
|
132
|
+
while (value.length < length) { value = '0' + value; }
|
133
|
+
return value;
|
134
|
+
},
|
135
|
+
ts = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0, u:0},
|
136
|
+
timestamp=0, dM, k,hl,
|
137
|
+
dateFormat=["i18n"];
|
138
|
+
// Internationalization strings
|
139
|
+
dateFormat.i18n = {
|
140
|
+
dayNames: opts.dayNames,
|
141
|
+
monthNames: opts.monthNames
|
142
|
+
};
|
143
|
+
if( format in opts.masks ) { format = opts.masks[format]; }
|
144
|
+
if(date.constructor === Number) {
|
145
|
+
timestamp = new Date(date);
|
146
|
+
} else if(date.constructor === Date) {
|
147
|
+
timestamp = date;
|
148
|
+
// Microsoft date format support
|
149
|
+
} else if( msMatch !== null ) {
|
150
|
+
timestamp = new Date(parseInt(msMatch[1], 10));
|
151
|
+
if (msMatch[3]) {
|
152
|
+
var offset = Number(msMatch[5]) * 60 + Number(msMatch[6]);
|
153
|
+
offset *= ((msMatch[4] == '-') ? 1 : -1);
|
154
|
+
offset -= timestamp.getTimezoneOffset();
|
155
|
+
timestamp.setTime(Number(Number(timestamp) + (offset * 60 * 1000)));
|
156
|
+
}
|
157
|
+
} else {
|
158
|
+
date = date.split(/[\\\/:_;.,\t\T\s-]/);
|
159
|
+
format = format.split(/[\\\/:_;.,\t\T\s-]/);
|
160
|
+
// parsing for month names
|
161
|
+
for(k=0,hl=format.length;k<hl;k++){
|
162
|
+
if(format[k] == 'M') {
|
163
|
+
dM = $.inArray(date[k],dateFormat.i18n.monthNames);
|
164
|
+
if(dM !== -1 && dM < 12){date[k] = dM+1;}
|
165
|
+
}
|
166
|
+
if(format[k] == 'F') {
|
167
|
+
dM = $.inArray(date[k],dateFormat.i18n.monthNames);
|
168
|
+
if(dM !== -1 && dM > 11){date[k] = dM+1-12;}
|
169
|
+
}
|
170
|
+
if(date[k]) {
|
171
|
+
ts[format[k].toLowerCase()] = parseInt(date[k],10);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
if(ts.f) { ts.m = ts.f; }
|
175
|
+
if( ts.m === 0 && ts.y === 0 && ts.d === 0) {
|
176
|
+
return " " ;
|
177
|
+
}
|
178
|
+
ts.m = parseInt(ts.m,10)-1;
|
179
|
+
var ty = ts.y;
|
180
|
+
if (ty >= 70 && ty <= 99) { ts.y = 1900+ts.y; }
|
181
|
+
else if (ty >=0 && ty <=69) { ts.y= 2000+ts.y; }
|
182
|
+
timestamp = new Date(ts.y, ts.m, ts.d, ts.h, ts.i, ts.s, ts.u);
|
183
|
+
}
|
184
|
+
|
185
|
+
if( newformat in opts.masks ) {
|
186
|
+
newformat = opts.masks[newformat];
|
187
|
+
} else if ( !newformat ) {
|
188
|
+
newformat = 'Y-m-d';
|
189
|
+
}
|
190
|
+
var
|
191
|
+
G = timestamp.getHours(),
|
192
|
+
i = timestamp.getMinutes(),
|
193
|
+
j = timestamp.getDate(),
|
194
|
+
n = timestamp.getMonth() + 1,
|
195
|
+
o = timestamp.getTimezoneOffset(),
|
196
|
+
s = timestamp.getSeconds(),
|
197
|
+
u = timestamp.getMilliseconds(),
|
198
|
+
w = timestamp.getDay(),
|
199
|
+
Y = timestamp.getFullYear(),
|
200
|
+
N = (w + 6) % 7 + 1,
|
201
|
+
z = (new Date(Y, n - 1, j) - new Date(Y, 0, 1)) / 86400000,
|
202
|
+
flags = {
|
203
|
+
// Day
|
204
|
+
d: pad(j),
|
205
|
+
D: dateFormat.i18n.dayNames[w],
|
206
|
+
j: j,
|
207
|
+
l: dateFormat.i18n.dayNames[w + 7],
|
208
|
+
N: N,
|
209
|
+
S: opts.S(j),
|
210
|
+
//j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th',
|
211
|
+
w: w,
|
212
|
+
z: z,
|
213
|
+
// Week
|
214
|
+
W: N < 5 ? Math.floor((z + N - 1) / 7) + 1 : Math.floor((z + N - 1) / 7) || ((new Date(Y - 1, 0, 1).getDay() + 6) % 7 < 4 ? 53 : 52),
|
215
|
+
// Month
|
216
|
+
F: dateFormat.i18n.monthNames[n - 1 + 12],
|
217
|
+
m: pad(n),
|
218
|
+
M: dateFormat.i18n.monthNames[n - 1],
|
219
|
+
n: n,
|
220
|
+
t: '?',
|
221
|
+
// Year
|
222
|
+
L: '?',
|
223
|
+
o: '?',
|
224
|
+
Y: Y,
|
225
|
+
y: String(Y).substring(2),
|
226
|
+
// Time
|
227
|
+
a: G < 12 ? opts.AmPm[0] : opts.AmPm[1],
|
228
|
+
A: G < 12 ? opts.AmPm[2] : opts.AmPm[3],
|
229
|
+
B: '?',
|
230
|
+
g: G % 12 || 12,
|
231
|
+
G: G,
|
232
|
+
h: pad(G % 12 || 12),
|
233
|
+
H: pad(G),
|
234
|
+
i: pad(i),
|
235
|
+
s: pad(s),
|
236
|
+
u: u,
|
237
|
+
// Timezone
|
238
|
+
e: '?',
|
239
|
+
I: '?',
|
240
|
+
O: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
|
241
|
+
P: '?',
|
242
|
+
T: (String(timestamp).match(timezone) || [""]).pop().replace(timezoneClip, ""),
|
243
|
+
Z: '?',
|
244
|
+
// Full Date/Time
|
245
|
+
c: '?',
|
246
|
+
r: '?',
|
247
|
+
U: Math.floor(timestamp / 1000)
|
248
|
+
};
|
249
|
+
return newformat.replace(token, function ($0) {
|
250
|
+
return $0 in flags ? flags[$0] : $0.substring(1);
|
251
|
+
});
|
252
|
+
}
|
253
|
+
};
|
254
|
+
$.fn.fmatter.defaultFormat = function(cellval, opts) {
|
255
|
+
return ($.fmatter.isValue(cellval) && cellval!=="" ) ? cellval : opts.defaultValue ? opts.defaultValue : " ";
|
256
|
+
};
|
257
|
+
$.fn.fmatter.email = function(cellval, opts) {
|
258
|
+
if(!$.fmatter.isEmpty(cellval)) {
|
259
|
+
return "<a href=\"mailto:" + cellval + "\">" + cellval + "</a>";
|
260
|
+
}else {
|
261
|
+
return $.fn.fmatter.defaultFormat(cellval,opts );
|
262
|
+
}
|
263
|
+
};
|
264
|
+
$.fn.fmatter.checkbox =function(cval, opts) {
|
265
|
+
var op = $.extend({},opts.checkbox), ds;
|
266
|
+
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
|
267
|
+
op = $.extend({},op,opts.colModel.formatoptions);
|
268
|
+
}
|
269
|
+
if(op.disabled===true) {ds = "disabled=\"disabled\"";} else {ds="";}
|
270
|
+
if($.fmatter.isEmpty(cval) || $.fmatter.isUndefined(cval) ) { cval = $.fn.fmatter.defaultFormat(cval,op); }
|
271
|
+
cval=cval+""; cval=cval.toLowerCase();
|
272
|
+
var bchk = cval.search(/(false|0|no|off)/i)<0 ? " checked='checked' " : "";
|
273
|
+
return "<input type=\"checkbox\" " + bchk + " value=\""+ cval+"\" offval=\"no\" "+ds+ "/>";
|
274
|
+
};
|
275
|
+
$.fn.fmatter.link = function(cellval, opts) {
|
276
|
+
var op = {target:opts.target };
|
277
|
+
var target = "";
|
278
|
+
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
|
279
|
+
op = $.extend({},op,opts.colModel.formatoptions);
|
280
|
+
}
|
281
|
+
if(op.target) {target = 'target=' + op.target;}
|
282
|
+
if(!$.fmatter.isEmpty(cellval)) {
|
283
|
+
return "<a "+target+" href=\"" + cellval + "\">" + cellval + "</a>";
|
284
|
+
}else {
|
285
|
+
return $.fn.fmatter.defaultFormat(cellval,opts);
|
286
|
+
}
|
287
|
+
};
|
288
|
+
$.fn.fmatter.showlink = function(cellval, opts) {
|
289
|
+
var op = {baseLinkUrl: opts.baseLinkUrl,showAction:opts.showAction, addParam: opts.addParam || "", target: opts.target, idName: opts.idName },
|
290
|
+
target = "", idUrl;
|
291
|
+
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
|
292
|
+
op = $.extend({},op,opts.colModel.formatoptions);
|
293
|
+
}
|
294
|
+
if(op.target) {target = 'target=' + op.target;}
|
295
|
+
idUrl = op.baseLinkUrl+op.showAction + '?'+ op.idName+'='+opts.rowId+op.addParam;
|
296
|
+
if($.fmatter.isString(cellval) || $.fmatter.isNumber(cellval)) { //add this one even if its blank string
|
297
|
+
return "<a "+target+" href=\"" + idUrl + "\">" + cellval + "</a>";
|
298
|
+
}else {
|
299
|
+
return $.fn.fmatter.defaultFormat(cellval,opts);
|
300
|
+
}
|
301
|
+
};
|
302
|
+
$.fn.fmatter.integer = function(cellval, opts) {
|
303
|
+
var op = $.extend({},opts.integer);
|
304
|
+
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
|
305
|
+
op = $.extend({},op,opts.colModel.formatoptions);
|
306
|
+
}
|
307
|
+
if($.fmatter.isEmpty(cellval)) {
|
308
|
+
return op.defaultValue;
|
309
|
+
}
|
310
|
+
return $.fmatter.util.NumberFormat(cellval,op);
|
311
|
+
};
|
312
|
+
$.fn.fmatter.number = function (cellval, opts) {
|
313
|
+
var op = $.extend({},opts.number);
|
314
|
+
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
|
315
|
+
op = $.extend({},op,opts.colModel.formatoptions);
|
316
|
+
}
|
317
|
+
if($.fmatter.isEmpty(cellval)) {
|
318
|
+
return op.defaultValue;
|
319
|
+
}
|
320
|
+
return $.fmatter.util.NumberFormat(cellval,op);
|
321
|
+
};
|
322
|
+
$.fn.fmatter.currency = function (cellval, opts) {
|
323
|
+
var op = $.extend({},opts.currency);
|
324
|
+
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
|
325
|
+
op = $.extend({},op,opts.colModel.formatoptions);
|
326
|
+
}
|
327
|
+
if($.fmatter.isEmpty(cellval)) {
|
328
|
+
return op.defaultValue;
|
329
|
+
}
|
330
|
+
return $.fmatter.util.NumberFormat(cellval,op);
|
331
|
+
};
|
332
|
+
$.fn.fmatter.date = function (cellval, opts, rwd, act) {
|
333
|
+
var op = $.extend({},opts.date);
|
334
|
+
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
|
335
|
+
op = $.extend({},op,opts.colModel.formatoptions);
|
336
|
+
}
|
337
|
+
if(!op.reformatAfterEdit && act=='edit'){
|
338
|
+
return $.fn.fmatter.defaultFormat(cellval, opts);
|
339
|
+
} else if(!$.fmatter.isEmpty(cellval)) {
|
340
|
+
return $.fmatter.util.DateFormat(op.srcformat,cellval,op.newformat,op);
|
341
|
+
} else {
|
342
|
+
return $.fn.fmatter.defaultFormat(cellval, opts);
|
343
|
+
}
|
344
|
+
};
|
345
|
+
$.fn.fmatter.select = function (cellval,opts, rwd, act) {
|
346
|
+
// jqGrid specific
|
347
|
+
cellval = cellval + "";
|
348
|
+
var oSelect = false, ret=[];
|
349
|
+
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)){
|
350
|
+
oSelect= opts.colModel.formatoptions.value;
|
351
|
+
} else if(!$.fmatter.isUndefined(opts.colModel.editoptions)){
|
352
|
+
oSelect= opts.colModel.editoptions.value;
|
353
|
+
}
|
354
|
+
if (oSelect) {
|
355
|
+
var msl = opts.colModel.editoptions.multiple === true ? true : false,
|
356
|
+
scell = [], sv;
|
357
|
+
if(msl) {scell = cellval.split(",");scell = $.map(scell,function(n){return $.trim(n);});}
|
358
|
+
if ($.fmatter.isString(oSelect)) {
|
359
|
+
// mybe here we can use some caching with care ????
|
360
|
+
var so = oSelect.split(";"), j=0;
|
361
|
+
for(var i=0; i<so.length;i++){
|
362
|
+
sv = so[i].split(":");
|
363
|
+
if(sv.length > 2 ) {
|
364
|
+
sv[1] = jQuery.map(sv,function(n,i){if(i>0) { return n; } }).join(":");
|
365
|
+
}
|
366
|
+
if(msl) {
|
367
|
+
if(jQuery.inArray(sv[0],scell)>-1) {
|
368
|
+
ret[j] = sv[1];
|
369
|
+
j++;
|
370
|
+
}
|
371
|
+
} else if($.trim(sv[0])==$.trim(cellval)) {
|
372
|
+
ret[0] = sv[1];
|
373
|
+
break;
|
374
|
+
}
|
375
|
+
}
|
376
|
+
} else if($.fmatter.isObject(oSelect)) {
|
377
|
+
// this is quicker
|
378
|
+
if(msl) {
|
379
|
+
ret = jQuery.map(scell, function(n, i){
|
380
|
+
return oSelect[n];
|
381
|
+
});
|
382
|
+
} else {
|
383
|
+
ret[0] = oSelect[cellval] || "";
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}
|
387
|
+
cellval = ret.join(", ");
|
388
|
+
return cellval === "" ? $.fn.fmatter.defaultFormat(cellval,opts) : cellval;
|
389
|
+
};
|
390
|
+
$.fn.fmatter.rowactions = function(rid,gid,act,pos) {
|
391
|
+
var op ={
|
392
|
+
keys:false,
|
393
|
+
editbutton:true,
|
394
|
+
delbutton:true,
|
395
|
+
onEdit : null,
|
396
|
+
onSuccess: null,
|
397
|
+
afterSave:null,
|
398
|
+
onError: null,
|
399
|
+
afterRestore: null,
|
400
|
+
extraparam: {oper:'edit'},
|
401
|
+
url: null,
|
402
|
+
delOptions: {}
|
403
|
+
},
|
404
|
+
cm = $('#'+gid)[0].p.colModel[pos];
|
405
|
+
if(!$.fmatter.isUndefined(cm.formatoptions)) {
|
406
|
+
op = $.extend(op,cm.formatoptions);
|
407
|
+
}
|
408
|
+
var saverow = function( rowid) {
|
409
|
+
if(op.afterSave) op.afterSave(rowid);
|
410
|
+
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
|
411
|
+
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
|
412
|
+
},
|
413
|
+
restorerow = function( rowid) {
|
414
|
+
if(op.afterRestore) op.afterRestore(rowid);
|
415
|
+
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
|
416
|
+
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
|
417
|
+
};
|
418
|
+
|
419
|
+
switch(act)
|
420
|
+
{
|
421
|
+
case 'edit':
|
422
|
+
$('#'+gid).jqGrid('editRow',rid, op.keys, op.onEdit, op.onSuccess, op.url, op.extraparam, saverow, op.onError,restorerow);
|
423
|
+
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).hide();
|
424
|
+
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).show();
|
425
|
+
break;
|
426
|
+
case 'save':
|
427
|
+
$('#'+gid).jqGrid('saveRow',rid, op.onSuccess,op.url, op.extraparam, saverow, op.onError,restorerow);
|
428
|
+
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
|
429
|
+
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
|
430
|
+
break;
|
431
|
+
case 'cancel' :
|
432
|
+
$('#'+gid).jqGrid('restoreRow',rid, restorerow);
|
433
|
+
$("tr#"+rid+" div.ui-inline-edit, "+"tr#"+rid+" div.ui-inline-del","#"+gid).show();
|
434
|
+
$("tr#"+rid+" div.ui-inline-save, "+"tr#"+rid+" div.ui-inline-cancel","#"+gid).hide();
|
435
|
+
break;
|
436
|
+
case 'del':
|
437
|
+
$('#'+gid).jqGrid('delGridRow',rid, op.delOptions);
|
438
|
+
break;
|
439
|
+
}
|
440
|
+
};
|
441
|
+
$.fn.fmatter.actions = function(cellval,opts, rwd) {
|
442
|
+
var op ={keys:false, editbutton:true, delbutton:true};
|
443
|
+
if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {
|
444
|
+
op = $.extend(op,opts.colModel.formatoptions);
|
445
|
+
}
|
446
|
+
var rowid = opts.rowId, str="",ocl;
|
447
|
+
if(typeof(rowid) =='undefined' || $.fmatter.isEmpty(rowid)) { return ""; }
|
448
|
+
if(op.editbutton){
|
449
|
+
ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','edit',"+opts.pos+");";
|
450
|
+
str =str+ "<div style='margin-left:8px;'><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>";
|
451
|
+
}
|
452
|
+
if(op.delbutton) {
|
453
|
+
ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','del',"+opts.pos+");";
|
454
|
+
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>";
|
455
|
+
}
|
456
|
+
ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','save',"+opts.pos+");";
|
457
|
+
str = str+"<div title='"+$.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save'><span class='ui-icon ui-icon-disk' "+ocl+"></span></div>";
|
458
|
+
ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','cancel',"+opts.pos+");";
|
459
|
+
str = str+"<div title='"+$.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel'><span class='ui-icon ui-icon-cancel' "+ocl+"></span></div></div>";
|
460
|
+
return str;
|
461
|
+
};
|
462
|
+
$.unformat = function (cellval,options,pos,cnt) {
|
463
|
+
// specific for jqGrid only
|
464
|
+
var ret, formatType = options.colModel.formatter,
|
465
|
+
op =options.colModel.formatoptions || {}, sep,
|
466
|
+
re = /([\.\*\_\'\(\)\{\}\+\?\\])/g,
|
467
|
+
unformatFunc = options.colModel.unformat||($.fn.fmatter[formatType] && $.fn.fmatter[formatType].unformat);
|
468
|
+
if(typeof unformatFunc !== 'undefined' && $.isFunction(unformatFunc) ) {
|
469
|
+
ret = unformatFunc($(cellval).text(), options, cellval);
|
470
|
+
} else if(!$.fmatter.isUndefined(formatType) && $.fmatter.isString(formatType) ) {
|
471
|
+
var opts = $.jgrid.formatter || {}, stripTag;
|
472
|
+
switch(formatType) {
|
473
|
+
case 'integer' :
|
474
|
+
op = $.extend({},opts.integer,op);
|
475
|
+
sep = op.thousandsSeparator.replace(re,"\\$1");
|
476
|
+
stripTag = new RegExp(sep, "g");
|
477
|
+
ret = $(cellval).text().replace(stripTag,'');
|
478
|
+
break;
|
479
|
+
case 'number' :
|
480
|
+
op = $.extend({},opts.number,op);
|
481
|
+
sep = op.thousandsSeparator.replace(re,"\\$1");
|
482
|
+
stripTag = new RegExp(sep, "g");
|
483
|
+
ret = $(cellval).text().replace(stripTag,"").replace(op.decimalSeparator,'.');
|
484
|
+
break;
|
485
|
+
case 'currency':
|
486
|
+
op = $.extend({},opts.currency,op);
|
487
|
+
sep = op.thousandsSeparator.replace(re,"\\$1");
|
488
|
+
stripTag = new RegExp(sep, "g");
|
489
|
+
ret = $(cellval).text().replace(stripTag,'').replace(op.decimalSeparator,'.').replace(op.prefix,'').replace(op.suffix,'');
|
490
|
+
break;
|
491
|
+
case 'checkbox':
|
492
|
+
var cbv = (options.colModel.editoptions) ? options.colModel.editoptions.value.split(":") : ["Yes","No"];
|
493
|
+
ret = $('input',cellval).attr("checked") ? cbv[0] : cbv[1];
|
494
|
+
break;
|
495
|
+
case 'select' :
|
496
|
+
ret = $.unformat.select(cellval,options,pos,cnt);
|
497
|
+
break;
|
498
|
+
case 'actions':
|
499
|
+
return "";
|
500
|
+
default:
|
501
|
+
ret= $(cellval).text();
|
502
|
+
}
|
503
|
+
}
|
504
|
+
return ret ? ret : cnt===true ? $(cellval).text() : $.jgrid.htmlDecode($(cellval).html());
|
505
|
+
};
|
506
|
+
$.unformat.select = function (cellval,options,pos,cnt) {
|
507
|
+
// Spacial case when we have local data and perform a sort
|
508
|
+
// cnt is set to true only in sortDataArray
|
509
|
+
var ret = [];
|
510
|
+
var cell = $(cellval).text();
|
511
|
+
if(cnt===true) { return cell; }
|
512
|
+
var op = $.extend({},options.colModel.editoptions);
|
513
|
+
if(op.value){
|
514
|
+
var oSelect = op.value,
|
515
|
+
msl = op.multiple === true ? true : false,
|
516
|
+
scell = [], sv;
|
517
|
+
if(msl) { scell = cell.split(","); scell = $.map(scell,function(n){return $.trim(n);}); }
|
518
|
+
if ($.fmatter.isString(oSelect)) {
|
519
|
+
var so = oSelect.split(";"), j=0;
|
520
|
+
for(var i=0; i<so.length;i++){
|
521
|
+
sv = so[i].split(":");
|
522
|
+
if(sv.length > 2 ) {
|
523
|
+
sv[1] = jQuery.map(sv,function(n,i){if(i>0) { return n; } }).join(":");
|
524
|
+
}
|
525
|
+
if(msl) {
|
526
|
+
if(jQuery.inArray(sv[1],scell)>-1) {
|
527
|
+
ret[j] = sv[0];
|
528
|
+
j++;
|
529
|
+
}
|
530
|
+
} else if($.trim(sv[1])==$.trim(cell)) {
|
531
|
+
ret[0] = sv[0];
|
532
|
+
break;
|
533
|
+
}
|
534
|
+
}
|
535
|
+
} else if($.fmatter.isObject(oSelect) || $.isArray(oSelect) ){
|
536
|
+
if(!msl) { scell[0] = cell; }
|
537
|
+
ret = jQuery.map(scell, function(n){
|
538
|
+
var rv;
|
539
|
+
$.each(oSelect, function(i,val){
|
540
|
+
if (val == n) {
|
541
|
+
rv = i;
|
542
|
+
return false;
|
543
|
+
}
|
544
|
+
});
|
545
|
+
if( typeof(rv) != 'undefined' ) { return rv; }
|
546
|
+
});
|
547
|
+
}
|
548
|
+
return ret.join(", ");
|
549
|
+
} else {
|
550
|
+
return cell || "";
|
551
|
+
}
|
552
|
+
};
|
553
|
+
$.unformat.date = function (cellval, opts) {
|
554
|
+
var op = $.jgrid.formatter.date || {};
|
555
|
+
if(!$.fmatter.isUndefined(opts.formatoptions)) {
|
556
|
+
op = $.extend({},op,opts.formatoptions);
|
557
|
+
}
|
558
|
+
if(!$.fmatter.isEmpty(cellval)) {
|
559
|
+
return $.fmatter.util.DateFormat(op.newformat,cellval,op.srcformat,op);
|
560
|
+
} else {
|
561
|
+
return $.fn.fmatter.defaultFormat(cellval, opts);
|
562
|
+
}
|
563
|
+
};
|
542
564
|
})(jQuery);
|