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
@@ -17,6 +17,7 @@ function jqGridInclude()
|
|
17
17
|
{ include: true, incfile:'grid.tbltogrid.js'}, //jqGrid table to grid
|
18
18
|
{ include: true, incfile:'grid.setcolumns.js'}, //jqGrid setcolumns
|
19
19
|
{ include: true, incfile:'grid.import.js'}, //jqGrid import
|
20
|
+
{ include: true, incfile:'grid.grouping.js'}, //jqGrid grouping
|
20
21
|
{ include: true, incfile:'jquery.fmatter.js'}, //jqGrid formater
|
21
22
|
{ include: true, incfile:'JsonXml.js'}, //xmljson utils
|
22
23
|
{ include: true, incfile:'jquery.searchFilter.js'} // search Plugin
|
@@ -1,64 +1,64 @@
|
|
1
|
-
;(function($){
|
2
|
-
/**
|
3
|
-
* jqGrid extension
|
4
|
-
* Paul Tiseo ptiseo@wasteconsultants.com
|
5
|
-
*
|
6
|
-
* Dual licensed under the MIT and GPL licenses:
|
7
|
-
* http://www.opensource.org/licenses/mit-license.php
|
8
|
-
* http://www.gnu.org/licenses/gpl-2.0.html
|
9
|
-
**/
|
10
|
-
$.jgrid.extend({
|
11
|
-
getPostData : function(){
|
12
|
-
var $t = this[0];
|
13
|
-
if(!$t.grid) { return; }
|
14
|
-
return $t.p.postData;
|
15
|
-
},
|
16
|
-
setPostData : function( newdata ) {
|
17
|
-
var $t = this[0];
|
18
|
-
if(!$t.grid) { return; }
|
19
|
-
// check if newdata is correct type
|
20
|
-
if ( typeof(newdata) === 'object' ) {
|
21
|
-
$t.p.postData = newdata;
|
22
|
-
}
|
23
|
-
else {
|
24
|
-
alert("Error: cannot add a non-object postData value. postData unchanged.");
|
25
|
-
}
|
26
|
-
},
|
27
|
-
appendPostData : function( newdata ) {
|
28
|
-
var $t = this[0];
|
29
|
-
if(!$t.grid) { return; }
|
30
|
-
// check if newdata is correct type
|
31
|
-
if ( typeof(newdata) === 'object' ) {
|
32
|
-
$.extend($t.p.postData, newdata);
|
33
|
-
}
|
34
|
-
else {
|
35
|
-
alert("Error: cannot append a non-object postData value. postData unchanged.");
|
36
|
-
}
|
37
|
-
},
|
38
|
-
setPostDataItem : function( key, val ) {
|
39
|
-
var $t = this[0];
|
40
|
-
if(!$t.grid) { return; }
|
41
|
-
$t.p.postData[key] = val;
|
42
|
-
},
|
43
|
-
getPostDataItem : function( key ) {
|
44
|
-
var $t = this[0];
|
45
|
-
if(!$t.grid) { return; }
|
46
|
-
return $t.p.postData[key];
|
47
|
-
},
|
48
|
-
removePostDataItem : function( key ) {
|
49
|
-
var $t = this[0];
|
50
|
-
if(!$t.grid) { return; }
|
51
|
-
delete $t.p.postData[key];
|
52
|
-
},
|
53
|
-
getUserData : function(){
|
54
|
-
var $t = this[0];
|
55
|
-
if(!$t.grid) { return; }
|
56
|
-
return $t.p.userData;
|
57
|
-
},
|
58
|
-
getUserDataItem : function( key ) {
|
59
|
-
var $t = this[0];
|
60
|
-
if(!$t.grid) { return; }
|
61
|
-
return $t.p.userData[key];
|
62
|
-
}
|
63
|
-
});
|
1
|
+
;(function($){
|
2
|
+
/**
|
3
|
+
* jqGrid extension
|
4
|
+
* Paul Tiseo ptiseo@wasteconsultants.com
|
5
|
+
*
|
6
|
+
* Dual licensed under the MIT and GPL licenses:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
* http://www.gnu.org/licenses/gpl-2.0.html
|
9
|
+
**/
|
10
|
+
$.jgrid.extend({
|
11
|
+
getPostData : function(){
|
12
|
+
var $t = this[0];
|
13
|
+
if(!$t.grid) { return; }
|
14
|
+
return $t.p.postData;
|
15
|
+
},
|
16
|
+
setPostData : function( newdata ) {
|
17
|
+
var $t = this[0];
|
18
|
+
if(!$t.grid) { return; }
|
19
|
+
// check if newdata is correct type
|
20
|
+
if ( typeof(newdata) === 'object' ) {
|
21
|
+
$t.p.postData = newdata;
|
22
|
+
}
|
23
|
+
else {
|
24
|
+
alert("Error: cannot add a non-object postData value. postData unchanged.");
|
25
|
+
}
|
26
|
+
},
|
27
|
+
appendPostData : function( newdata ) {
|
28
|
+
var $t = this[0];
|
29
|
+
if(!$t.grid) { return; }
|
30
|
+
// check if newdata is correct type
|
31
|
+
if ( typeof(newdata) === 'object' ) {
|
32
|
+
$.extend($t.p.postData, newdata);
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
alert("Error: cannot append a non-object postData value. postData unchanged.");
|
36
|
+
}
|
37
|
+
},
|
38
|
+
setPostDataItem : function( key, val ) {
|
39
|
+
var $t = this[0];
|
40
|
+
if(!$t.grid) { return; }
|
41
|
+
$t.p.postData[key] = val;
|
42
|
+
},
|
43
|
+
getPostDataItem : function( key ) {
|
44
|
+
var $t = this[0];
|
45
|
+
if(!$t.grid) { return; }
|
46
|
+
return $t.p.postData[key];
|
47
|
+
},
|
48
|
+
removePostDataItem : function( key ) {
|
49
|
+
var $t = this[0];
|
50
|
+
if(!$t.grid) { return; }
|
51
|
+
delete $t.p.postData[key];
|
52
|
+
},
|
53
|
+
getUserData : function(){
|
54
|
+
var $t = this[0];
|
55
|
+
if(!$t.grid) { return; }
|
56
|
+
return $t.p.userData;
|
57
|
+
},
|
58
|
+
getUserDataItem : function( key ) {
|
59
|
+
var $t = this[0];
|
60
|
+
if(!$t.grid) { return; }
|
61
|
+
return $t.p.userData[key];
|
62
|
+
}
|
63
|
+
});
|
64
64
|
})(jQuery);
|
@@ -1,126 +1,126 @@
|
|
1
|
-
;(function($){
|
2
|
-
/**
|
3
|
-
* jqGrid extension for manipulating columns properties
|
4
|
-
* Piotr Roznicki roznicki@o2.pl
|
5
|
-
* http://www.roznicki.prv.pl
|
6
|
-
* Dual licensed under the MIT and GPL licenses:
|
7
|
-
* http://www.opensource.org/licenses/mit-license.php
|
8
|
-
* http://www.gnu.org/licenses/gpl-2.0.html
|
9
|
-
**/
|
10
|
-
$.jgrid.extend({
|
11
|
-
setColumns : function(p) {
|
12
|
-
p = $.extend({
|
13
|
-
top : 0,
|
14
|
-
left: 0,
|
15
|
-
width: 200,
|
16
|
-
height: 'auto',
|
17
|
-
dataheight: 'auto',
|
18
|
-
modal: false,
|
19
|
-
drag: true,
|
20
|
-
beforeShowForm: null,
|
21
|
-
afterShowForm: null,
|
22
|
-
afterSubmitForm: null,
|
23
|
-
closeOnEscape : true,
|
24
|
-
ShrinkToFit : false,
|
25
|
-
jqModal : false,
|
26
|
-
saveicon: [true,"left","ui-icon-disk"],
|
27
|
-
closeicon: [true,"left","ui-icon-close"],
|
28
|
-
onClose : null,
|
29
|
-
colnameview : true,
|
30
|
-
closeAfterSubmit : true,
|
31
|
-
updateAfterCheck : false,
|
32
|
-
recreateForm : false
|
33
|
-
}, $.jgrid.col, p ||{});
|
34
|
-
return this.each(function(){
|
35
|
-
var $t = this;
|
36
|
-
if (!$t.grid ) { return; }
|
37
|
-
var onBeforeShow = typeof p.beforeShowForm === 'function' ? true: false;
|
38
|
-
var onAfterShow = typeof p.afterShowForm === 'function' ? true: false;
|
39
|
-
var onAfterSubmit = typeof p.afterSubmitForm === 'function' ? true: false;
|
40
|
-
var gID = $t.p.id,
|
41
|
-
dtbl = "ColTbl_"+gID,
|
42
|
-
IDs = {themodal:'colmod'+gID,modalhead:'colhd'+gID,modalcontent:'colcnt'+gID, scrollelm: dtbl};
|
43
|
-
if(p.recreateForm===true && $("#"+IDs.themodal).html() != null) {
|
44
|
-
$("#"+IDs.themodal).remove();
|
45
|
-
}
|
46
|
-
if ( $("#"+IDs.themodal).html() != null ) {
|
47
|
-
if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
|
48
|
-
viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM:false, modal:p.modal});
|
49
|
-
if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
|
50
|
-
} else {
|
51
|
-
var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
|
52
|
-
var formdata = "<div id='"+dtbl+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+dh+";'>";
|
53
|
-
formdata += "<table class='ColTable' cellspacing='1' cellpading='2' border='0'><tbody>";
|
54
|
-
for(i=0;i<this.p.colNames.length;i++){
|
55
|
-
if(!$t.p.colModel[i].hidedlg) { // added from T. Tomov
|
56
|
-
formdata += "<tr><td style='white-space: pre;'><input type='checkbox' style='margin-right:5px;' id='col_" + this.p.colModel[i].name + "' class='cbox' value='T' " +
|
57
|
-
((this.p.colModel[i].hidden===false)?"checked":"") + "/>" + "<label for='col_" + this.p.colModel[i].name + "'>" + this.p.colNames[i] + ((p.colnameview) ? " (" + this.p.colModel[i].name + ")" : "" )+ "</label></td></tr>";
|
58
|
-
}
|
59
|
-
}
|
60
|
-
formdata += "</tbody></table></div>"
|
61
|
-
var bS = !p.updateAfterCheck ? "<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>" : "",
|
62
|
-
bC ="<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
|
63
|
-
formdata += "<table border='0' class='EditTable' id='"+dtbl+"_2'><tbody><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DataTD ui-widget-content'></td></tr><tr><td class='ColButton EditButton'>"+bS+" "+bC+"</td></tr></tbody></table>";
|
64
|
-
p.gbox = "#gbox_"+gID;
|
65
|
-
createModal(IDs,formdata,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
|
66
|
-
if(p.saveicon[0]==true) {
|
67
|
-
$("#dData","#"+dtbl+"_2").addClass(p.saveicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
|
68
|
-
.append("<span class='ui-icon "+p.saveicon[2]+"'></span>");
|
69
|
-
}
|
70
|
-
if(p.closeicon[0]==true) {
|
71
|
-
$("#eData","#"+dtbl+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
|
72
|
-
.append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
|
73
|
-
}
|
74
|
-
if(!p.updateAfterCheck) {
|
75
|
-
$("#dData","#"+dtbl+"_2").click(function(e){
|
76
|
-
for(i=0;i<$t.p.colModel.length;i++){
|
77
|
-
if(!$t.p.colModel[i].hidedlg) { // added from T. Tomov
|
78
|
-
var nm = $t.p.colModel[i].name.replace(
|
79
|
-
if($("#col_" + nm,"#"+dtbl).attr("checked")) {
|
80
|
-
$($t).jqGrid("showCol",$t.p.colModel[i].name);
|
81
|
-
$("#col_" + nm,"#"+dtbl).attr("defaultChecked",true); // Added from T. Tomov IE BUG
|
82
|
-
} else {
|
83
|
-
$($t).jqGrid("hideCol",$t.p.colModel[i].name);
|
84
|
-
$("#col_" + nm,"#"+dtbl).attr("defaultChecked",""); // Added from T. Tomov IE BUG
|
85
|
-
}
|
86
|
-
}
|
87
|
-
}
|
88
|
-
if(p.ShrinkToFit===true) {
|
89
|
-
$($t).jqGrid("setGridWidth",$t.grid.width-0.001,true);
|
90
|
-
}
|
91
|
-
if(p.closeAfterSubmit) hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
|
92
|
-
if (onAfterSubmit) { p.afterSubmitForm($("#"+dtbl)); }
|
93
|
-
return false;
|
94
|
-
});
|
95
|
-
} else {
|
96
|
-
$(":input","#"+dtbl).click(function(e){
|
97
|
-
var cn = this.id.substr(4);
|
98
|
-
if(cn){
|
99
|
-
if(this.checked) {
|
100
|
-
$($t).jqGrid("showCol",cn);
|
101
|
-
} else {
|
102
|
-
$($t).jqGrid("hideCol",cn);
|
103
|
-
}
|
104
|
-
if(p.ShrinkToFit===true) {
|
105
|
-
$($t).jqGrid("setGridWidth",$t.grid.width-0.001,true);
|
106
|
-
}
|
107
|
-
}
|
108
|
-
return this;
|
109
|
-
});
|
110
|
-
}
|
111
|
-
$("#eData", "#"+dtbl+"_2").click(function(e){
|
112
|
-
hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
|
113
|
-
return false;
|
114
|
-
});
|
115
|
-
$("#dData, #eData","#"+dtbl+"_2").hover(
|
116
|
-
function(){$(this).addClass('ui-state-hover');},
|
117
|
-
function(){$(this).removeClass('ui-state-hover');}
|
118
|
-
);
|
119
|
-
if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
|
120
|
-
viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: true, modal:p.modal});
|
121
|
-
if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
|
122
|
-
}
|
123
|
-
});
|
124
|
-
}
|
125
|
-
});
|
1
|
+
;(function($){
|
2
|
+
/**
|
3
|
+
* jqGrid extension for manipulating columns properties
|
4
|
+
* Piotr Roznicki roznicki@o2.pl
|
5
|
+
* http://www.roznicki.prv.pl
|
6
|
+
* Dual licensed under the MIT and GPL licenses:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
* http://www.gnu.org/licenses/gpl-2.0.html
|
9
|
+
**/
|
10
|
+
$.jgrid.extend({
|
11
|
+
setColumns : function(p) {
|
12
|
+
p = $.extend({
|
13
|
+
top : 0,
|
14
|
+
left: 0,
|
15
|
+
width: 200,
|
16
|
+
height: 'auto',
|
17
|
+
dataheight: 'auto',
|
18
|
+
modal: false,
|
19
|
+
drag: true,
|
20
|
+
beforeShowForm: null,
|
21
|
+
afterShowForm: null,
|
22
|
+
afterSubmitForm: null,
|
23
|
+
closeOnEscape : true,
|
24
|
+
ShrinkToFit : false,
|
25
|
+
jqModal : false,
|
26
|
+
saveicon: [true,"left","ui-icon-disk"],
|
27
|
+
closeicon: [true,"left","ui-icon-close"],
|
28
|
+
onClose : null,
|
29
|
+
colnameview : true,
|
30
|
+
closeAfterSubmit : true,
|
31
|
+
updateAfterCheck : false,
|
32
|
+
recreateForm : false
|
33
|
+
}, $.jgrid.col, p ||{});
|
34
|
+
return this.each(function(){
|
35
|
+
var $t = this;
|
36
|
+
if (!$t.grid ) { return; }
|
37
|
+
var onBeforeShow = typeof p.beforeShowForm === 'function' ? true: false;
|
38
|
+
var onAfterShow = typeof p.afterShowForm === 'function' ? true: false;
|
39
|
+
var onAfterSubmit = typeof p.afterSubmitForm === 'function' ? true: false;
|
40
|
+
var gID = $t.p.id,
|
41
|
+
dtbl = "ColTbl_"+gID,
|
42
|
+
IDs = {themodal:'colmod'+gID,modalhead:'colhd'+gID,modalcontent:'colcnt'+gID, scrollelm: dtbl};
|
43
|
+
if(p.recreateForm===true && $("#"+IDs.themodal).html() != null) {
|
44
|
+
$("#"+IDs.themodal).remove();
|
45
|
+
}
|
46
|
+
if ( $("#"+IDs.themodal).html() != null ) {
|
47
|
+
if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
|
48
|
+
$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM:false, modal:p.modal});
|
49
|
+
if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
|
50
|
+
} else {
|
51
|
+
var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
|
52
|
+
var formdata = "<div id='"+dtbl+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+dh+";'>";
|
53
|
+
formdata += "<table class='ColTable' cellspacing='1' cellpading='2' border='0'><tbody>";
|
54
|
+
for(i=0;i<this.p.colNames.length;i++){
|
55
|
+
if(!$t.p.colModel[i].hidedlg) { // added from T. Tomov
|
56
|
+
formdata += "<tr><td style='white-space: pre;'><input type='checkbox' style='margin-right:5px;' id='col_" + this.p.colModel[i].name + "' class='cbox' value='T' " +
|
57
|
+
((this.p.colModel[i].hidden===false)?"checked":"") + "/>" + "<label for='col_" + this.p.colModel[i].name + "'>" + this.p.colNames[i] + ((p.colnameview) ? " (" + this.p.colModel[i].name + ")" : "" )+ "</label></td></tr>";
|
58
|
+
}
|
59
|
+
}
|
60
|
+
formdata += "</tbody></table></div>"
|
61
|
+
var bS = !p.updateAfterCheck ? "<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>" : "",
|
62
|
+
bC ="<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
|
63
|
+
formdata += "<table border='0' class='EditTable' id='"+dtbl+"_2'><tbody><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DataTD ui-widget-content'></td></tr><tr><td class='ColButton EditButton'>"+bS+" "+bC+"</td></tr></tbody></table>";
|
64
|
+
p.gbox = "#gbox_"+gID;
|
65
|
+
$.jgrid.createModal(IDs,formdata,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
|
66
|
+
if(p.saveicon[0]==true) {
|
67
|
+
$("#dData","#"+dtbl+"_2").addClass(p.saveicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
|
68
|
+
.append("<span class='ui-icon "+p.saveicon[2]+"'></span>");
|
69
|
+
}
|
70
|
+
if(p.closeicon[0]==true) {
|
71
|
+
$("#eData","#"+dtbl+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
|
72
|
+
.append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
|
73
|
+
}
|
74
|
+
if(!p.updateAfterCheck) {
|
75
|
+
$("#dData","#"+dtbl+"_2").click(function(e){
|
76
|
+
for(i=0;i<$t.p.colModel.length;i++){
|
77
|
+
if(!$t.p.colModel[i].hidedlg) { // added from T. Tomov
|
78
|
+
var nm = $t.p.colModel[i].name.replace(/\./g, "\\.");
|
79
|
+
if($("#col_" + nm,"#"+dtbl).attr("checked")) {
|
80
|
+
$($t).jqGrid("showCol",$t.p.colModel[i].name);
|
81
|
+
$("#col_" + nm,"#"+dtbl).attr("defaultChecked",true); // Added from T. Tomov IE BUG
|
82
|
+
} else {
|
83
|
+
$($t).jqGrid("hideCol",$t.p.colModel[i].name);
|
84
|
+
$("#col_" + nm,"#"+dtbl).attr("defaultChecked",""); // Added from T. Tomov IE BUG
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
if(p.ShrinkToFit===true) {
|
89
|
+
$($t).jqGrid("setGridWidth",$t.grid.width-0.001,true);
|
90
|
+
}
|
91
|
+
if(p.closeAfterSubmit) $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
|
92
|
+
if (onAfterSubmit) { p.afterSubmitForm($("#"+dtbl)); }
|
93
|
+
return false;
|
94
|
+
});
|
95
|
+
} else {
|
96
|
+
$(":input","#"+dtbl).click(function(e){
|
97
|
+
var cn = this.id.substr(4);
|
98
|
+
if(cn){
|
99
|
+
if(this.checked) {
|
100
|
+
$($t).jqGrid("showCol",cn);
|
101
|
+
} else {
|
102
|
+
$($t).jqGrid("hideCol",cn);
|
103
|
+
}
|
104
|
+
if(p.ShrinkToFit===true) {
|
105
|
+
$($t).jqGrid("setGridWidth",$t.grid.width-0.001,true);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
return this;
|
109
|
+
});
|
110
|
+
}
|
111
|
+
$("#eData", "#"+dtbl+"_2").click(function(e){
|
112
|
+
$.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
|
113
|
+
return false;
|
114
|
+
});
|
115
|
+
$("#dData, #eData","#"+dtbl+"_2").hover(
|
116
|
+
function(){$(this).addClass('ui-state-hover');},
|
117
|
+
function(){$(this).removeClass('ui-state-hover');}
|
118
|
+
);
|
119
|
+
if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
|
120
|
+
$.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: true, modal:p.modal});
|
121
|
+
if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
|
122
|
+
}
|
123
|
+
});
|
124
|
+
}
|
125
|
+
});
|
126
126
|
})(jQuery);
|
@@ -1,260 +1,260 @@
|
|
1
|
-
;(function($){
|
2
|
-
/**
|
3
|
-
* jqGrid extension for SubGrid Data
|
4
|
-
* Tony Tomov tony@trirand.com
|
5
|
-
* http://trirand.com/blog/
|
6
|
-
* Dual licensed under the MIT and GPL licenses:
|
7
|
-
* http://www.opensource.org/licenses/mit-license.php
|
8
|
-
* http://www.gnu.org/licenses/gpl-2.0.html
|
9
|
-
**/
|
10
|
-
$.jgrid.extend({
|
11
|
-
setSubGrid : function () {
|
12
|
-
return this.each(function (){
|
13
|
-
var $t = this, cm;
|
14
|
-
$t.p.colNames.unshift("");
|
15
|
-
$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});
|
16
|
-
cm = $t.p.subGridModel;
|
17
|
-
if(cm[0]) {
|
18
|
-
cm[0].align = $.extend([],cm[0].align || []);
|
19
|
-
for(var i=0;i<cm[0].name.length;i++) { cm[0].align[i] = cm[0].align[i] || 'left';}
|
20
|
-
}
|
21
|
-
});
|
22
|
-
},
|
23
|
-
addSubGridCell :function (pos,iRow) {
|
24
|
-
var prp='',gv,sid;
|
25
|
-
this.each(function(){
|
26
|
-
prp = this.formatCol(pos,iRow);
|
27
|
-
gv = this.p.gridview;
|
28
|
-
sid= this.p.id;
|
29
|
-
});
|
30
|
-
if( gv === false ){
|
31
|
-
return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" class=\"ui-sgcollapsed sgcollapsed\" "+prp+"><a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a></td>";
|
32
|
-
} else {
|
33
|
-
return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" " +prp +"></td>";
|
34
|
-
}
|
35
|
-
},
|
36
|
-
addSubGrid : function(t,pos) {
|
37
|
-
return this.each(function(){
|
38
|
-
var ts = this;
|
39
|
-
if (!ts.grid ) { return; }
|
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
|
-
return false;
|
204
|
-
};
|
205
|
-
ts.subGridXml = function(xml,sid) {subGridXml(xml,sid);};
|
206
|
-
ts.subGridJson = function(json,sid) {subGridJson(json,sid);};
|
207
|
-
});
|
208
|
-
},
|
209
|
-
expandSubGridRow : function(rowid) {
|
210
|
-
return this.each(function () {
|
211
|
-
var $t = this;
|
212
|
-
if(!$t.grid && !rowid) {return;}
|
213
|
-
if($t.p.subGrid===true) {
|
214
|
-
var rc = $(this).jqGrid("getInd",rowid,true);
|
215
|
-
if(rc) {
|
216
|
-
var sgc = $("td.sgcollapsed",rc)[0];
|
217
|
-
if(sgc) {
|
218
|
-
$(sgc).trigger("click");
|
219
|
-
}
|
220
|
-
}
|
221
|
-
}
|
222
|
-
});
|
223
|
-
},
|
224
|
-
collapseSubGridRow : function(rowid) {
|
225
|
-
return this.each(function () {
|
226
|
-
var $t = this;
|
227
|
-
if(!$t.grid && !rowid) {return;}
|
228
|
-
if($t.p.subGrid===true) {
|
229
|
-
var rc = $(this).jqGrid("getInd",rowid,true);
|
230
|
-
if(rc) {
|
231
|
-
var sgc = $("td.sgexpanded",rc)[0];
|
232
|
-
if(sgc) {
|
233
|
-
$(sgc).trigger("click");
|
234
|
-
}
|
235
|
-
}
|
236
|
-
}
|
237
|
-
});
|
238
|
-
},
|
239
|
-
toggleSubGridRow : function(rowid) {
|
240
|
-
return this.each(function () {
|
241
|
-
var $t = this;
|
242
|
-
if(!$t.grid && !rowid) {return;}
|
243
|
-
if($t.p.subGrid===true) {
|
244
|
-
var rc = $(this).jqGrid("getInd",rowid,true);
|
245
|
-
if(rc) {
|
246
|
-
var sgc = $("td.sgcollapsed",rc)[0];
|
247
|
-
if(sgc) {
|
248
|
-
$(sgc).trigger("click");
|
249
|
-
} else {
|
250
|
-
sgc = $("td.sgexpanded",rc)[0];
|
251
|
-
if(sgc) {
|
252
|
-
$(sgc).trigger("click");
|
253
|
-
}
|
254
|
-
}
|
255
|
-
}
|
256
|
-
}
|
257
|
-
});
|
258
|
-
}
|
259
|
-
});
|
260
|
-
})(jQuery);
|
1
|
+
;(function($){
|
2
|
+
/**
|
3
|
+
* jqGrid extension for SubGrid Data
|
4
|
+
* Tony Tomov tony@trirand.com
|
5
|
+
* http://trirand.com/blog/
|
6
|
+
* Dual licensed under the MIT and GPL licenses:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
* http://www.gnu.org/licenses/gpl-2.0.html
|
9
|
+
**/
|
10
|
+
$.jgrid.extend({
|
11
|
+
setSubGrid : function () {
|
12
|
+
return this.each(function (){
|
13
|
+
var $t = this, cm;
|
14
|
+
$t.p.colNames.unshift("");
|
15
|
+
$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});
|
16
|
+
cm = $t.p.subGridModel;
|
17
|
+
if(cm[0]) {
|
18
|
+
cm[0].align = $.extend([],cm[0].align || []);
|
19
|
+
for(var i=0;i<cm[0].name.length;i++) { cm[0].align[i] = cm[0].align[i] || 'left';}
|
20
|
+
}
|
21
|
+
});
|
22
|
+
},
|
23
|
+
addSubGridCell :function (pos,iRow) {
|
24
|
+
var prp='',gv,sid;
|
25
|
+
this.each(function(){
|
26
|
+
prp = this.formatCol(pos,iRow);
|
27
|
+
gv = this.p.gridview;
|
28
|
+
sid= this.p.id;
|
29
|
+
});
|
30
|
+
if( gv === false ){
|
31
|
+
return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" class=\"ui-sgcollapsed sgcollapsed\" "+prp+"><a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a></td>";
|
32
|
+
} else {
|
33
|
+
return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" " +prp +"></td>";
|
34
|
+
}
|
35
|
+
},
|
36
|
+
addSubGrid : function(t,pos) {
|
37
|
+
return this.each(function(){
|
38
|
+
var ts = this;
|
39
|
+
if (!ts.grid ) { return; }
|
40
|
+
//-------------------------
|
41
|
+
var subGridCell = function(trdiv,cell,pos){
|
42
|
+
var tddiv = $("<td align='"+ts.p.subGridModel[0].align[pos]+"'></td>").html(cell);
|
43
|
+
$(trdiv).append(tddiv);
|
44
|
+
};
|
45
|
+
var subGridXml = function(sjxml, sbid){
|
46
|
+
var tddiv, i, sgmap,
|
47
|
+
dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
|
48
|
+
trdiv = $("<tr></tr>");
|
49
|
+
for (i = 0; i<ts.p.subGridModel[0].name.length; i++) {
|
50
|
+
tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>");
|
51
|
+
$(tddiv).html(ts.p.subGridModel[0].name[i]);
|
52
|
+
$(tddiv).width( ts.p.subGridModel[0].width[i]);
|
53
|
+
$(trdiv).append(tddiv);
|
54
|
+
}
|
55
|
+
$(dummy).append(trdiv);
|
56
|
+
if (sjxml){
|
57
|
+
sgmap = ts.p.xmlReader.subgrid;
|
58
|
+
$(sgmap.root+" "+sgmap.row, sjxml).each( function(){
|
59
|
+
trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>");
|
60
|
+
if(sgmap.repeatitems === true) {
|
61
|
+
$(sgmap.cell,this).each( function(i) {
|
62
|
+
subGridCell(trdiv, $(this).text() || ' ',i);
|
63
|
+
});
|
64
|
+
} else {
|
65
|
+
var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name;
|
66
|
+
if (f) {
|
67
|
+
for (i=0;i<f.length;i++) {
|
68
|
+
subGridCell(trdiv, $(f[i],this).text() || ' ',i);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
$(dummy).append(trdiv);
|
73
|
+
});
|
74
|
+
}
|
75
|
+
var pID = $("table:first",ts.grid.bDiv).attr("id")+"_";
|
76
|
+
$("#"+pID+sbid).append(dummy);
|
77
|
+
ts.grid.hDiv.loading = false;
|
78
|
+
$("#load_"+ts.p.id).hide();
|
79
|
+
return false;
|
80
|
+
};
|
81
|
+
var subGridJson = function(sjxml, sbid){
|
82
|
+
var tddiv,result , i,cur, sgmap,j,
|
83
|
+
dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
|
84
|
+
trdiv = $("<tr></tr>");
|
85
|
+
for (i = 0; i<ts.p.subGridModel[0].name.length; i++) {
|
86
|
+
tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>");
|
87
|
+
$(tddiv).html(ts.p.subGridModel[0].name[i]);
|
88
|
+
$(tddiv).width( ts.p.subGridModel[0].width[i]);
|
89
|
+
$(trdiv).append(tddiv);
|
90
|
+
}
|
91
|
+
$(dummy).append(trdiv);
|
92
|
+
if (sjxml){
|
93
|
+
sgmap = ts.p.jsonReader.subgrid;
|
94
|
+
result = sjxml[sgmap.root];
|
95
|
+
if ( typeof result !== 'undefined' ) {
|
96
|
+
for (i=0;i<result.length;i++) {
|
97
|
+
cur = result[i];
|
98
|
+
trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>");
|
99
|
+
if(sgmap.repeatitems === true) {
|
100
|
+
if(sgmap.cell) { cur=cur[sgmap.cell]; }
|
101
|
+
for (j=0;j<cur.length;j++) {
|
102
|
+
subGridCell(trdiv, cur[j] || ' ',j);
|
103
|
+
}
|
104
|
+
} else {
|
105
|
+
var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name;
|
106
|
+
if(f.length) {
|
107
|
+
for (j=0;j<f.length;j++) {
|
108
|
+
subGridCell(trdiv, cur[f[j]] || ' ',j);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
$(dummy).append(trdiv);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
var pID = $("table:first",ts.grid.bDiv).attr("id")+"_";
|
117
|
+
$("#"+pID+sbid).append(dummy);
|
118
|
+
ts.grid.hDiv.loading = false;
|
119
|
+
$("#load_"+ts.p.id).hide();
|
120
|
+
return false;
|
121
|
+
};
|
122
|
+
var populatesubgrid = function( rd ) {
|
123
|
+
var sid,dp, i, j;
|
124
|
+
sid = $(rd).attr("id");
|
125
|
+
dp = {nd_: (new Date().getTime())};
|
126
|
+
dp[ts.p.prmNames.subgridid]=sid;
|
127
|
+
if(!ts.p.subGridModel[0]) { return false; }
|
128
|
+
if(ts.p.subGridModel[0].params) {
|
129
|
+
for(j=0; j < ts.p.subGridModel[0].params.length; j++) {
|
130
|
+
for(i=0; i<ts.p.colModel.length; i++) {
|
131
|
+
if(ts.p.colModel[i].name == ts.p.subGridModel[0].params[j]) {
|
132
|
+
dp[ts.p.colModel[i].name]= $("td:eq("+i+")",rd).text().replace(/\ \;/ig,'');
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
if(!ts.grid.hDiv.loading) {
|
138
|
+
ts.grid.hDiv.loading = true;
|
139
|
+
$("#load_"+ts.p.id).show();
|
140
|
+
if(!ts.p.subgridtype) { ts.p.subgridtype = ts.p.datatype; }
|
141
|
+
if($.isFunction(ts.p.subgridtype)) {
|
142
|
+
ts.p.subgridtype.call(ts, dp);
|
143
|
+
} else {
|
144
|
+
ts.p.subgridtype = ts.p.subgridtype.toLowerCase();
|
145
|
+
}
|
146
|
+
switch(ts.p.subgridtype) {
|
147
|
+
case "xml":
|
148
|
+
case "json":
|
149
|
+
$.ajax($.extend({
|
150
|
+
type:ts.p.mtype,
|
151
|
+
url: ts.p.subGridUrl,
|
152
|
+
dataType:ts.p.subgridtype,
|
153
|
+
data: $.isFunction(ts.p.serializeSubGridData)? ts.p.serializeSubGridData.call(ts, dp) : dp,
|
154
|
+
complete: function(sxml) {
|
155
|
+
if(ts.p.subgridtype == "xml") {
|
156
|
+
subGridXml(sxml.responseXML, sid);
|
157
|
+
} else {
|
158
|
+
subGridJson($.jgrid.parse(sxml.responseText),sid);
|
159
|
+
}
|
160
|
+
sxml=null;
|
161
|
+
}
|
162
|
+
}, $.jgrid.ajaxOptions, ts.p.ajaxSubgridOptions || {}));
|
163
|
+
break;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
return false;
|
167
|
+
};
|
168
|
+
var res,_id, pID,atd, nhc, subdata, bfsc;
|
169
|
+
$("td:eq("+pos+")",t).click( function(e) {
|
170
|
+
if($(this).hasClass("sgcollapsed")) {
|
171
|
+
pID = ts.p.id;
|
172
|
+
res = $(this).parent();
|
173
|
+
atd = pos >=1 ? "<td colspan='"+pos+"'> </td>":"";
|
174
|
+
_id = $(res).attr("id");
|
175
|
+
bfsc =true;
|
176
|
+
if($.isFunction(ts.p.subGridBeforeExpand)) {
|
177
|
+
bfsc = ts.p.subGridBeforeExpand.call(ts, pID+"_"+_id,_id);
|
178
|
+
}
|
179
|
+
if(bfsc === false) {return false;}
|
180
|
+
nhc = 0;
|
181
|
+
$.each(ts.p.colModel,function(i,v){
|
182
|
+
if(this.hidden === true || this.name == 'rn' || this.name == 'cb') {nhc++;}
|
183
|
+
});
|
184
|
+
subdata = "<tr role='row' class='ui-subgrid'>"+atd+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon ui-icon-carat-1-sw'/></td><td colspan='"+parseInt(ts.p.colNames.length-1-nhc,10)+"' class='ui-widget-content subgrid-data'><div id="+pID+"_"+_id+" class='tablediv'>";
|
185
|
+
$(this).parent().after( subdata+ "</div></td></tr>" );
|
186
|
+
if( $.isFunction(ts.p.subGridRowExpanded)) {
|
187
|
+
ts.p.subGridRowExpanded.call(ts, pID+"_"+ _id,_id);
|
188
|
+
} else {
|
189
|
+
populatesubgrid(res);
|
190
|
+
}
|
191
|
+
$(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-minus'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");
|
192
|
+
} else if($(this).hasClass("sgexpanded")) {
|
193
|
+
bfsc = true;
|
194
|
+
if( $.isFunction(ts.p.subGridRowColapsed)) {
|
195
|
+
res = $(this).parent();
|
196
|
+
_id = $(res).attr("id");
|
197
|
+
bfsc = ts.p.subGridRowColapsed.call(ts, pID+"_"+_id,_id );
|
198
|
+
}
|
199
|
+
if(bfsc===false) {return false;}
|
200
|
+
$(this).parent().next().remove(".ui-subgrid");
|
201
|
+
$(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");
|
202
|
+
}
|
203
|
+
return false;
|
204
|
+
});
|
205
|
+
ts.subGridXml = function(xml,sid) {subGridXml(xml,sid);};
|
206
|
+
ts.subGridJson = function(json,sid) {subGridJson(json,sid);};
|
207
|
+
});
|
208
|
+
},
|
209
|
+
expandSubGridRow : function(rowid) {
|
210
|
+
return this.each(function () {
|
211
|
+
var $t = this;
|
212
|
+
if(!$t.grid && !rowid) {return;}
|
213
|
+
if($t.p.subGrid===true) {
|
214
|
+
var rc = $(this).jqGrid("getInd",rowid,true);
|
215
|
+
if(rc) {
|
216
|
+
var sgc = $("td.sgcollapsed",rc)[0];
|
217
|
+
if(sgc) {
|
218
|
+
$(sgc).trigger("click");
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
});
|
223
|
+
},
|
224
|
+
collapseSubGridRow : function(rowid) {
|
225
|
+
return this.each(function () {
|
226
|
+
var $t = this;
|
227
|
+
if(!$t.grid && !rowid) {return;}
|
228
|
+
if($t.p.subGrid===true) {
|
229
|
+
var rc = $(this).jqGrid("getInd",rowid,true);
|
230
|
+
if(rc) {
|
231
|
+
var sgc = $("td.sgexpanded",rc)[0];
|
232
|
+
if(sgc) {
|
233
|
+
$(sgc).trigger("click");
|
234
|
+
}
|
235
|
+
}
|
236
|
+
}
|
237
|
+
});
|
238
|
+
},
|
239
|
+
toggleSubGridRow : function(rowid) {
|
240
|
+
return this.each(function () {
|
241
|
+
var $t = this;
|
242
|
+
if(!$t.grid && !rowid) {return;}
|
243
|
+
if($t.p.subGrid===true) {
|
244
|
+
var rc = $(this).jqGrid("getInd",rowid,true);
|
245
|
+
if(rc) {
|
246
|
+
var sgc = $("td.sgcollapsed",rc)[0];
|
247
|
+
if(sgc) {
|
248
|
+
$(sgc).trigger("click");
|
249
|
+
} else {
|
250
|
+
sgc = $("td.sgexpanded",rc)[0];
|
251
|
+
if(sgc) {
|
252
|
+
$(sgc).trigger("click");
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}
|
257
|
+
});
|
258
|
+
}
|
259
|
+
});
|
260
|
+
})(jQuery);
|