f751a19c41de82ba4d782dc4c6af7b9e0ffb63f2.svn-base
1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
;(function($){
/**
* jqGrid extension
* Paul Tiseo ptiseo@wasteconsultants.com
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
**/
$.jgrid.extend({
getPostData : function(){
var $t = this[0];
if(!$t.grid) { return; }
return $t.p.postData;
},
setPostData : function( newdata ) {
var $t = this[0];
if(!$t.grid) { return; }
// check if newdata is correct type
if ( typeof(newdata) === 'object' ) {
$t.p.postData = newdata;
}
else {
alert("Error: cannot add a non-object postData value. postData unchanged.");
}
},
appendPostData : function( newdata ) {
var $t = this[0];
if(!$t.grid) { return; }
// check if newdata is correct type
if ( typeof(newdata) === 'object' ) {
$.extend($t.p.postData, newdata);
}
else {
alert("Error: cannot append a non-object postData value. postData unchanged.");
}
},
setPostDataItem : function( key, val ) {
var $t = this[0];
if(!$t.grid) { return; }
$t.p.postData[key] = val;
},
getPostDataItem : function( key ) {
var $t = this[0];
if(!$t.grid) { return; }
return $t.p.postData[key];
},
removePostDataItem : function( key ) {
var $t = this[0];
if(!$t.grid) { return; }
delete $t.p.postData[key];
},
getUserData : function(){
var $t = this[0];
if(!$t.grid) { return; }
return $t.p.userData;
},
getUserDataItem : function( key ) {
var $t = this[0];
if(!$t.grid) { return; }
return $t.p.userData[key];
}
});
})(jQuery);