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
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
|
/*
@author dhtmlx.com
@license GPL, see license.txt
*/
if (window.dhtmlXGridObject && !dhtmlXGridObject.prototype._init_point_connector){
dhtmlXGridObject.prototype._init_point_connector=dhtmlXGridObject.prototype._init_point;
dhtmlXGridObject.prototype._init_point=function(){
//make separate config array for each grid
this._con_f_used = [].concat(this._con_f_used);
dhtmlXGridObject.prototype._con_f_used=[];
var clear_url=function(url){
url=url.replace(/(\?|\&)connector[^\f]*/g,"");
return url+(url.indexOf("?")!=-1?"&":"?")+"connector=true"+(this.hdr.rows.length > 0 ? "&dhx_no_header=1":"");
};
var combine_urls=function(url){
return clear_url.call(this,url)+(this._connector_sorting||"")+(this._connector_filter||"");
};
var sorting_url=function(url,ind,dir){
this._connector_sorting="&dhx_sort["+ind+"]="+dir;
return combine_urls.call(this,url);
};
var filtering_url=function(url,inds,vals){
var chunks = [];
for (var i=0; i<inds.length; i++)
chunks[i]="dhx_filter["+inds[i]+"]="+encodeURIComponent(vals[i]);
this._connector_filter="&"+chunks.join("&");
return combine_urls.call(this,url);
};
this.attachEvent("onCollectValues",function(ind){
if (this._con_f_used[ind]){
if (typeof(this._con_f_used[ind]) == "object")
return this._con_f_used[ind];
else
return false;
}
return true;
});
this.attachEvent("onDynXLS",function(){
this.xmlFileUrl=combine_urls.call(this,this.xmlFileUrl);
return true;
});
this.attachEvent("onBeforeSorting",function(ind,type,dir){
if (type=="connector"){
var self=this;
this.clearAndLoad(sorting_url.call(this,this.xmlFileUrl,ind,dir),function(){
self.setSortImgState(true,ind,dir);
});
return false;
}
return true;
});
this.attachEvent("onFilterStart",function(a,b){
var ss = this.getSortingState();
if (this._con_f_used.length){
var self=this;
this.clearAndLoad(filtering_url.call(this,this.xmlFileUrl,a,b));
if (ss.length)
self.setSortImgState(true,ss[0],ss[1]);
return false;
}
return true;
});
this.attachEvent("onXLE",function(a,b,c,xml){
if (!xml) return;
});
if (this._init_point_connector) this._init_point_connector();
};
dhtmlXGridObject.prototype._con_f_used=[];
dhtmlXGridObject.prototype._in_header_connector_text_filter=function(t,i){
if (!this._con_f_used[i])
this._con_f_used[i]=1;
return this._in_header_text_filter(t,i);
};
dhtmlXGridObject.prototype._in_header_connector_select_filter=function(t,i){
if (!this._con_f_used[i])
this._con_f_used[i]=2;
return this._in_header_select_filter(t,i);
};
dhtmlXGridObject.prototype.load_connector=dhtmlXGridObject.prototype.load;
dhtmlXGridObject.prototype.load=function(url, call, type){
if (!this._colls_loaded && this.cellType){
var ar=[];
for (var i=0; i < this.cellType.length; i++)
if (this.cellType[i].indexOf("co")==0 || this.cellType[i].indexOf("clist")==0 || this._con_f_used[i]==2) ar.push(i);
if (ar.length)
arguments[0]+=(arguments[0].indexOf("?")!=-1?"&":"?")+"connector=true&dhx_colls="+ar.join(",");
}
return this.load_connector.apply(this,arguments);
};
dhtmlXGridObject.prototype._parseHead_connector=dhtmlXGridObject.prototype._parseHead;
dhtmlXGridObject.prototype._parseHead=function(url, call, type){
this._parseHead_connector.apply(this,arguments);
if (!this._colls_loaded){
var cols = this.xmlLoader.doXPath("./coll_options", arguments[0]);
for (var i=0; i < cols.length; i++){
var f = cols[i].getAttribute("for");
var v = [];
var combo=null;
if (this.cellType[f] == "combo")
combo = this.getColumnCombo(f);
else if (this.cellType[f].indexOf("co")==0)
combo=this.getCombo(f);
var os = this.xmlLoader.doXPath("./item",cols[i]);
var opts = [];
for (var j=0; j<os.length; j++){
var val=os[j].getAttribute("value");
if (combo){
var lab=os[j].getAttribute("label")||val;
if (combo.addOption)
opts.push([val, lab]);
else
combo.put(val,lab);
v[v.length]=lab;
} else
v[v.length]=val;
}
if (opts.length){
if (combo)
combo.addOption(opts);
} else if (v.length && !combo)
if (this.registerCList)
this.registerCList(f*1, v);
if (this._con_f_used[f*1])
this._con_f_used[f*1]=v;
}
this._colls_loaded=true;
}
};
}
if (window.dataProcessor && !dataProcessor.prototype.init_original){
dataProcessor.prototype.init_original=dataProcessor.prototype.init;
dataProcessor.prototype.init=function(obj){
this.init_original(obj);
obj._dataprocessor=this;
this.setTransactionMode("POST",true);
this.serverProcessor+=(this.serverProcessor.indexOf("?")!=-1?"&":"?")+"editing=true";
};
}
dhtmlxError.catchError("LoadXML",function(a,b,c){
alert(c[0].responseText);
});
|