[4001] | 1 | /*
|
---|
| 2 | dhx_sort[index]=direction
|
---|
| 3 | dhx_filter[index]=mask
|
---|
| 4 | */
|
---|
| 5 | if (window.dhtmlXGridObject){
|
---|
| 6 | dhtmlXGridObject.prototype._init_point_connector=dhtmlXGridObject.prototype._init_point;
|
---|
| 7 | dhtmlXGridObject.prototype._init_point=function(){
|
---|
| 8 | var clear_url=function(url){
|
---|
| 9 | url=url.replace(/(\?|\&)connector[^\f]*/g,"");
|
---|
| 10 | return url+(url.indexOf("?")!=-1?"&":"?")+"connector=true"+(mygrid.hdr.rows.length > 0 ? "&dhx_no_header=1":"");
|
---|
| 11 | };
|
---|
| 12 | var combine_urls=function(url){
|
---|
| 13 | return clear_url(url)+(this._connector_sorting||"")+(this._connector_filter||"");
|
---|
| 14 | };
|
---|
| 15 | var sorting_url=function(url,ind,dir){
|
---|
| 16 | this._connector_sorting="&dhx_sort["+ind+"]="+dir;
|
---|
| 17 | return combine_urls.call(this,url);
|
---|
| 18 | };
|
---|
| 19 | var filtering_url=function(url,inds,vals){
|
---|
| 20 | for (var i=0; i<inds.length; i++)
|
---|
| 21 | inds[i]="dhx_filter["+inds[i]+"]="+encodeURIComponent(vals[i]);
|
---|
| 22 | this._connector_filter="&"+inds.join("&");
|
---|
| 23 | return combine_urls.call(this,url);
|
---|
| 24 | };
|
---|
| 25 | this.attachEvent("onCollectValues",function(ind){
|
---|
| 26 | if (this._con_f_used[ind]){
|
---|
| 27 | if (typeof(this._con_f_used[ind]) == "object")
|
---|
| 28 | return this._con_f_used[ind];
|
---|
| 29 | else
|
---|
| 30 | return false;
|
---|
| 31 | }
|
---|
| 32 | return true;
|
---|
| 33 | });
|
---|
| 34 | this.attachEvent("onDynXLS",function(){
|
---|
| 35 | this.xmlFileUrl=combine_urls.call(this,this.xmlFileUrl);
|
---|
| 36 | return true;
|
---|
| 37 | });
|
---|
| 38 | this.attachEvent("onBeforeSorting",function(ind,type,dir){
|
---|
| 39 | if (type=="connector"){
|
---|
| 40 | var self=this;
|
---|
| 41 | this.clearAndLoad(sorting_url.call(this,this.xmlFileUrl,ind,dir),function(){
|
---|
| 42 | self.setSortImgState(true,ind,dir);
|
---|
| 43 | });
|
---|
| 44 | return false;
|
---|
| 45 | }
|
---|
| 46 | return true;
|
---|
| 47 | });
|
---|
| 48 | this.attachEvent("onFilterStart",function(a,b){
|
---|
| 49 | if (this._con_f_used.length){
|
---|
| 50 | this.clearAndLoad(filtering_url.call(this,this.xmlFileUrl,a,b));
|
---|
| 51 | return false;
|
---|
| 52 | }
|
---|
| 53 | return true;
|
---|
| 54 | });
|
---|
| 55 | this.attachEvent("onXLE",function(a,b,c,xml){
|
---|
| 56 | if (!xml) return;
|
---|
| 57 | });
|
---|
| 58 |
|
---|
| 59 | if (this._init_point_connector) this._init_point_connector();
|
---|
| 60 | };
|
---|
| 61 | dhtmlXGridObject.prototype._con_f_used=[];
|
---|
| 62 | dhtmlXGridObject.prototype._in_header_connector_text_filter=function(t,i){
|
---|
| 63 | if (!this._con_f_used[i])
|
---|
| 64 | this._con_f_used[i]=1;
|
---|
| 65 | return this._in_header_text_filter(t,i);
|
---|
| 66 | };
|
---|
| 67 | dhtmlXGridObject.prototype._in_header_connector_select_filter=function(t,i){
|
---|
| 68 | if (!this._con_f_used[i])
|
---|
| 69 | this._con_f_used[i]=2;
|
---|
| 70 | return this._in_header_select_filter(t,i);
|
---|
| 71 | };
|
---|
| 72 | dhtmlXGridObject.prototype.load_connector=dhtmlXGridObject.prototype.load;
|
---|
| 73 | dhtmlXGridObject.prototype.load=function(url, call, type){
|
---|
| 74 | if (!this._colls_loaded && this.cellType){
|
---|
| 75 | var ar=[];
|
---|
| 76 | for (var i=0; i < this.cellType.length; i++)
|
---|
| 77 | if (this.cellType[i].indexOf("co")==0 || this._con_f_used[i]==2) ar.push(i);
|
---|
| 78 | if (ar.length)
|
---|
| 79 | arguments[0]+=(arguments[0].indexOf("?")!=-1?"&":"?")+"connector=true&dhx_colls="+ar.join(",");
|
---|
| 80 | }
|
---|
| 81 | return this.load_connector.apply(this,arguments);
|
---|
| 82 | };
|
---|
| 83 | dhtmlXGridObject.prototype._parseHead_connector=dhtmlXGridObject.prototype._parseHead;
|
---|
| 84 | dhtmlXGridObject.prototype._parseHead=function(url, call, type){
|
---|
| 85 | this._parseHead_connector.apply(this,arguments);
|
---|
| 86 | if (!this._colls_loaded){
|
---|
| 87 | var cols = this.xmlLoader.doXPath("./coll_options", arguments[0]);
|
---|
| 88 | for (var i=0; i < cols.length; i++){
|
---|
| 89 | var f = cols[i].getAttribute("for");
|
---|
| 90 | var v = [];
|
---|
| 91 | var combo=null;
|
---|
| 92 | if (this.cellType[f] == "combo")
|
---|
| 93 | combo = this.getColumnCombo(f);
|
---|
| 94 | if (this.cellType[f].indexOf("co")==0)
|
---|
| 95 | combo=this.getCombo(f);
|
---|
| 96 |
|
---|
| 97 | var os = this.xmlLoader.doXPath("./item",cols[i]);
|
---|
| 98 | for (var j=0; j<os.length; j++){
|
---|
| 99 | var val=os[j].getAttribute("value");
|
---|
| 100 |
|
---|
| 101 | if (combo){
|
---|
| 102 | var lab=os[j].getAttribute("label")||val;
|
---|
| 103 |
|
---|
| 104 | if (combo.addOption)
|
---|
| 105 | combo.addOption([[val, lab]]);
|
---|
| 106 | else
|
---|
| 107 | combo.put(val,lab);
|
---|
| 108 |
|
---|
| 109 | v[v.length]=lab;
|
---|
| 110 | } else
|
---|
| 111 | v[v.length]=val;
|
---|
| 112 | }
|
---|
| 113 | if (this._con_f_used[f*1])
|
---|
| 114 | this._con_f_used[f*1]=v;
|
---|
| 115 | };
|
---|
| 116 | this._colls_loaded=true;
|
---|
| 117 | }
|
---|
| 118 | };
|
---|
| 119 |
|
---|
| 120 |
|
---|
| 121 |
|
---|
| 122 |
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | if (window.dataProcessor){
|
---|
| 126 | dataProcessor.prototype.init_original=dataProcessor.prototype.init;
|
---|
| 127 | dataProcessor.prototype.init=function(obj){
|
---|
| 128 | this.init_original(obj);
|
---|
| 129 | obj._dataprocessor=this;
|
---|
| 130 |
|
---|
| 131 | this.setTransactionMode("POST",true);
|
---|
| 132 | this.serverProcessor+=(this.serverProcessor.indexOf("?")!=-1?"&":"?")+"editing=true";
|
---|
| 133 | };
|
---|
| 134 | };
|
---|
| 135 | dhtmlxError.catchError("LoadXML",function(a,b,c){
|
---|
| 136 | alert(c[0].responseText);
|
---|
| 137 | });
|
---|