Add version files and new GIF images for UI components
This commit is contained in:
1131
themes/sources/dhtmlxTreeGrid/codebase/dhtmlxtreegrid.js
Normal file
1131
themes/sources/dhtmlxTreeGrid/codebase/dhtmlxtreegrid.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,377 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
//beware that function started from _in_header_ must not be obfuscated
|
||||
|
||||
|
||||
/**
|
||||
* @desc: allows to define , which level of tree must be used for filtering
|
||||
* @type: public
|
||||
* @param: level - level value, -1 value means last one
|
||||
* @edition: Professional
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXGridObject.prototype.setFiltrationLevel=function(level,show_lower,show_upper){
|
||||
this._tr_strfltr=level;
|
||||
this._tr_fltr_c=show_lower;
|
||||
this._tr_fltr_d=show_upper;
|
||||
this.refreshFilters();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @desc: filter grid by mask
|
||||
* @type: public
|
||||
* @param: column - {number} zero based index of column
|
||||
* @param: value - {string} filtering mask
|
||||
* @param: preserve - {bool} filter current or initial state ( false by default )
|
||||
* @edition: Professional
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXGridObject.prototype.filterTreeBy=function(column, value, preserve){
|
||||
var origin = this._h2;
|
||||
if (typeof this._tr_strfltr == "undefined") this._tr_strfltr=-1;
|
||||
if (this._f_rowsBuffer){
|
||||
if (!preserve){
|
||||
this._h2=this._f_rowsBuffer;
|
||||
if (this._fake) this._fake._h2=this._h2;
|
||||
}
|
||||
} else
|
||||
this._f_rowsBuffer=this._h2; //backup copy
|
||||
|
||||
//if (!this.rowsBuffer.length && preserve) return;
|
||||
var d=true;
|
||||
this.dma(true)
|
||||
this._fbf={};
|
||||
if (typeof(column)=="object")
|
||||
for (var j=0; j<value.length; j++)
|
||||
this._filterTreeA(column[j],value[j]);
|
||||
else
|
||||
this._filterTreeA(column,value);
|
||||
this._fbf=null;
|
||||
this.dma(false)
|
||||
this._fix_filtered_images(this._h2,origin);
|
||||
this._renderSort()
|
||||
this.callEvent("onGridReconstructed",[])
|
||||
}
|
||||
dhtmlXGridObject.prototype._filterTreeA=function(column,value){
|
||||
if (value=="") return;
|
||||
var d=true;
|
||||
if (typeof(value)=="function") d=false;
|
||||
else value=(value||"").toString().toLowerCase();
|
||||
|
||||
var add_line=function(el,s,t){
|
||||
var z=t.get[el.parent.id];
|
||||
if (!z) z=add_line(el.parent,s,t)
|
||||
var t=temp.get[el.id];
|
||||
if (!t){
|
||||
t={id:el.id, childs:[], level:el.level, parent:z, index:z.childs.length, image:el.image, state:el.state, buff:el.buff, has_kids:el.has_kids, _xml_await:el._xml_await};
|
||||
z.childs.push(t);
|
||||
temp.get[t.id]=t;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
var fbf=this._fbf;
|
||||
var temp = this._createHierarchy();
|
||||
var check;
|
||||
var mode = this._tr_strfltr;
|
||||
var that=this;
|
||||
var temp_c=function(el){
|
||||
for (var i=0; i < el.childs.length; i++)
|
||||
that.temp(el.childs[i]);
|
||||
}
|
||||
switch(mode.toString()){
|
||||
case "-2": check=function(el){ if (fbf[el.id]) return false; temp_c(el); return true;}; break;
|
||||
case "-1": check=function(el){return !el.childs.length;}; break;
|
||||
default: check=function(el){return mode==el.level}; break;
|
||||
}
|
||||
this.temp=function(el){
|
||||
if (el.id!=0 && check(el)){
|
||||
if (d?(this._get_cell_value(el.buff,column).toString().toLowerCase().indexOf(value)==-1):(!value(this._get_cell_value(el.buff,column),el.id))){
|
||||
fbf[el.id]=true;
|
||||
if (this._tr_fltr_c) add_line(el.parent,this._h2,temp);
|
||||
return false;
|
||||
} else {
|
||||
add_line(el,this._h2,temp);
|
||||
if (el.childs && mode!=-2)
|
||||
this._h2.forEachChild(el.id,function(cel){
|
||||
add_line(cel,this._h2,temp);
|
||||
},this)
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (this._tr_fltr_d && this._tr_strfltr > el.level && el.id!=0) add_line(el,this._h2,temp);
|
||||
temp_c(el);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.temp(this._h2.get[0]);
|
||||
this._h2=temp;
|
||||
if (this._fake) this._fake._h2=this._h2;
|
||||
}
|
||||
|
||||
dhtmlXGridObject.prototype._fix_filtered_images=function(temp,origin){
|
||||
temp.forEachChild(0,function(el){
|
||||
if (!el.childs.length && !el.has_kids){
|
||||
if (el.state!=this._emptyLineImg){
|
||||
el.state=this._emptyLineImg;
|
||||
el.update=true;
|
||||
this._updateTGRState(el);
|
||||
}
|
||||
} else {
|
||||
if (el.buff.tagName=="TR"){
|
||||
var prev=origin.get[el.id];
|
||||
if (prev && prev.state!=this._emptyLineImg)
|
||||
el.state=prev.state;
|
||||
el.update=true;
|
||||
this._updateTGRState(el);
|
||||
}
|
||||
}
|
||||
},this)
|
||||
}
|
||||
/**
|
||||
* @desc: get all possible values in column
|
||||
* @type: public
|
||||
* @param: column - {number} zero based index of column
|
||||
* @returns: {array} array of all possible values in column
|
||||
* @edition: Professional
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXGridObject.prototype.collectTreeValues=function(column){
|
||||
if (typeof this._tr_strfltr == "undefined") this._tr_strfltr=-1;
|
||||
this.dma(true)
|
||||
this._build_m_order();
|
||||
column=this._m_order?this._m_order[column]:column;
|
||||
var c={}; var f=[];
|
||||
var col=this._f_rowsBuffer||this._h2;
|
||||
col.forEachChild(0,function(el){
|
||||
if (this._tr_strfltr==-2 || (this._tr_strfltr==-1 && !el.childs.length) || (this._tr_strfltr==el.level)){
|
||||
var val=this._get_cell_value(el.buff,column);
|
||||
if (val) c[val]=true;
|
||||
}
|
||||
},this);
|
||||
this.dma(false)
|
||||
|
||||
var vals=this.combos[column];
|
||||
for (var d in c)
|
||||
if (c[d]===true) f.push(vals?(vals.get(d)||d):d);
|
||||
|
||||
return f.sort();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_total=function(t,i,c){
|
||||
var calck=function(){
|
||||
var summ=0;
|
||||
this._build_m_order();
|
||||
var ii = this._m_order?this._m_order[i]:i;
|
||||
this._h2.forEachChild(0,function(el){
|
||||
var v=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),ii));
|
||||
summ+=isNaN(v)?0:v;
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):(Math.round(summ*100)/100);
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_total_leaf=function(t,i,c){
|
||||
var calck=function(){
|
||||
var summ=0;
|
||||
this._build_m_order();
|
||||
var ii = this._m_order?this._m_order[i]:i;
|
||||
this._h2.forEachChild(0,function(el){
|
||||
if (el.childs.length) return;
|
||||
var v=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),ii));
|
||||
summ+=isNaN(v)?0:v;
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):(Math.round(summ*100)/100);
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_multi_total=function(t,i,c){
|
||||
var cols=c[1].split(":"); c[1]="";
|
||||
var calck=function(){
|
||||
var summ=0;
|
||||
this._h2.forEachChild(0,function(el){
|
||||
var v=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),cols[0]))*parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),cols[1]));
|
||||
summ+=isNaN(v)?0:v;
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):(Math.round(summ*100)/100);
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_multi_total_leaf=function(t,i,c){
|
||||
var cols=c[1].split(":"); c[1]="";
|
||||
var calck=function(){
|
||||
var summ=0;
|
||||
this._h2.forEachChild(0,function(el){
|
||||
if (el.childs.length) return;
|
||||
var v=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),cols[0]))*parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),cols[1]));
|
||||
summ+=isNaN(v)?0:v;
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):(Math.round(summ*100)/100);
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_max=function(t,i,c){
|
||||
var calck=function(){
|
||||
var summ=-999999999;
|
||||
this._build_m_order();
|
||||
var ii = this._m_order?this._m_order[i]:i;
|
||||
if (this.getRowsNum()==0) return "";
|
||||
this._h2.forEachChild(0,function(el){
|
||||
var d=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),ii));
|
||||
if (!isNaN(d))
|
||||
summ=Math.max(summ,d);
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):summ;
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_min=function(t,i,c){
|
||||
var calck=function(){
|
||||
var summ=999999999;
|
||||
this._build_m_order();
|
||||
var ii = this._m_order?this._m_order[i]:i;
|
||||
if (this.getRowsNum()==0) return "";
|
||||
this._h2.forEachChild(0,function(el){
|
||||
var d=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),ii));
|
||||
if (!isNaN(d))
|
||||
summ=Math.min(summ,d);
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):summ;
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_average=function(t,i,c){
|
||||
var calck=function(){
|
||||
var summ=0; var count=0;
|
||||
this._build_m_order();
|
||||
var ii = this._m_order?this._m_order[i]:i;
|
||||
this._h2.forEachChild(0,function(el){
|
||||
var v=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),ii));
|
||||
summ+=isNaN(v)?0:v;
|
||||
count++;
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):(Math.round(summ/count*100)/100);
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_max_leaf=function(t,i,c){
|
||||
var calck=function(){
|
||||
var summ=-999999999;
|
||||
this._build_m_order();
|
||||
var ii = this._m_order?this._m_order[i]:i;
|
||||
if (this.getRowsNum()==0) return "";
|
||||
this._h2.forEachChild(0,function(el){
|
||||
if (el.childs.length) return;
|
||||
var d=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),ii));
|
||||
if (!isNaN(d))
|
||||
summ=Math.max(summ,d);
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):summ;
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_min_leaf=function(t,i,c){
|
||||
var calck=function(){
|
||||
var summ=999999999;
|
||||
this._build_m_order();
|
||||
var ii = this._m_order?this._m_order[i]:i;
|
||||
if (this.getRowsNum()==0) return "";
|
||||
this._h2.forEachChild(0,function(el){
|
||||
if (el.childs.length) return;
|
||||
var d=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),ii));
|
||||
if (!isNaN(d))
|
||||
summ=Math.min(summ,d);
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):summ;
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_average_leaf=function(t,i,c){
|
||||
var calck=function(){
|
||||
var summ=0; var count=0;
|
||||
this._build_m_order();
|
||||
var ii = this._m_order?this._m_order[i]:i;
|
||||
this._h2.forEachChild(0,function(el){
|
||||
if (el.childs.length) return;
|
||||
var v=parseFloat(this._get_cell_value((el.buff||this.rowsAr[el.id]),ii));
|
||||
summ+=isNaN(v)?0:v;
|
||||
count++;
|
||||
},this)
|
||||
return this._maskArr[i]?this._aplNF(summ,i):(Math.round(summ/count*100)/100);
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_count=function(t,i,c){
|
||||
var calck=function(){
|
||||
var count=0;
|
||||
this._h2.forEachChild(0,function(el){
|
||||
count++;
|
||||
},this)
|
||||
return count;
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c);
|
||||
}
|
||||
dhtmlXGridObject.prototype._in_header_stat_tree_count_leaf=function(t,i,c){
|
||||
var calck=function(){
|
||||
var count=0;
|
||||
this._h2.forEachChild(0,function(el){
|
||||
if (!el.childs.length) count++;
|
||||
},this)
|
||||
return count;
|
||||
}
|
||||
this._stat_in_header(t,calck,i,c);
|
||||
}
|
||||
|
||||
dhtmlXGridObject.prototype._stat_in_header=function(t,calck,i,c){
|
||||
// if (this._realfake) return this._fake._stat_in_header(t,calck,i,c);
|
||||
var that=this;
|
||||
var f=function(){
|
||||
this.dma(true)
|
||||
t.innerHTML=(c[0]?c[0]:"")+calck.call(this)+(c[1]?c[1]:"");
|
||||
this.dma(false)
|
||||
this.callEvent("onStatReady",[])
|
||||
}
|
||||
if (!this._stat_events) {
|
||||
this._stat_events=[];
|
||||
this.attachEvent("onClearAll",function(){
|
||||
if (!this.hdr.rows[1]){
|
||||
for (var i=0; i<this._stat_events.length; i++)
|
||||
for (var j=0; j < 4; j++)
|
||||
this.detachEvent(this._stat_events[i][j]);
|
||||
this._stat_events=[];
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this._stat_events.push([
|
||||
this.attachEvent("onGridReconstructed",f),
|
||||
this.attachEvent("onXLE",f),
|
||||
this.attachEvent("onFilterEnd",f),
|
||||
this.attachEvent("onEditCell",function(stage,id,ind){
|
||||
if (stage==2 && ind==i) f.call(this);
|
||||
return true;
|
||||
})]);
|
||||
t.innerHTML="";
|
||||
}
|
||||
dhtmlXGridObject.prototype._build_m_order=function(){
|
||||
if (this._c_order){
|
||||
this._m_order=[]
|
||||
for (var i=0; i < this._c_order.length; i++) {
|
||||
this._m_order[this._c_order[i]]=i;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
|
||||
@ -0,0 +1,150 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
dhtmlXGridObject.prototype._updateLine=function(z,row){
|
||||
row=row||this.rowsAr[z.id];
|
||||
if (!row) return;
|
||||
var im=row.imgTag;
|
||||
if (!im) return;
|
||||
if (z.state=="blank") return im.src=this.iconTree+"blank.gif";
|
||||
|
||||
var n=1;
|
||||
if (z.index==0){
|
||||
if (z.level==0){
|
||||
if ((z.parent.childs.length-1)>z.index)
|
||||
n=3;
|
||||
else n=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((z.parent.childs.length-1)>z.index)
|
||||
n=3;
|
||||
else
|
||||
n=2;
|
||||
}
|
||||
}
|
||||
else
|
||||
if ((z.parent.childs.length-1)>z.index)
|
||||
n=3;
|
||||
else
|
||||
n=2;
|
||||
|
||||
|
||||
im.src=this.iconTree+z.state+n+".gif";
|
||||
}
|
||||
dhtmlXGridObject.prototype._updateParentLine=function(z,row){
|
||||
row=row||this.rowsAr[z.id];
|
||||
if (!row) return;
|
||||
var im=row.imgTag;
|
||||
if (!im) return;
|
||||
for (var i=z.level; i>0; i--){
|
||||
if (z.id==0) break;
|
||||
im=im.previousSibling;
|
||||
z=z.parent;
|
||||
if ((z.parent.childs.length-1)>z.index)
|
||||
im.src=this.iconTree+"line1.gif";
|
||||
else
|
||||
im.src=this.iconTree+"blank.gif";
|
||||
}
|
||||
}
|
||||
|
||||
dhtmlXGridObject.prototype._renderSortA=dhtmlXGridObject.prototype._renderSort;
|
||||
dhtmlXGridObject.prototype._renderSort=function(){
|
||||
this._renderSortA.apply(this,arguments);
|
||||
this._redrawLines(0)
|
||||
}
|
||||
dhtmlXGridObject.prototype._redrawLines=function(id){
|
||||
if (this._tgle)
|
||||
this._h2.forEachChild((id||0),function(z){
|
||||
this._updateLine(z);
|
||||
this._updateParentLine(z);
|
||||
},this);
|
||||
}
|
||||
/**
|
||||
* @desc: enable lines in treeGrid
|
||||
* @type: public
|
||||
* @edition: Professional
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXGridObject.prototype.enableTreeGridLines=function(){
|
||||
this._emptyLineImg="line";
|
||||
|
||||
|
||||
this._updateTGRState=function(z,force){
|
||||
if (force || !z.update || z.id==0) return;
|
||||
if (this._tgle)
|
||||
this._updateLine(z,this.rowsAr[z.id]);
|
||||
z.update=false;
|
||||
}
|
||||
|
||||
this._tgle=true;
|
||||
this.attachEvent("onXLE",function(a,b,id){
|
||||
this._redrawLines(id)
|
||||
});
|
||||
|
||||
this.attachEvent("onOpenEnd",function(id){
|
||||
this._redrawLines(id)
|
||||
});
|
||||
|
||||
|
||||
this.attachEvent("onRowAdded",function(id){
|
||||
var z=this._h2.get[id];
|
||||
this._updateLine(z);
|
||||
this._updateParentLine(z);
|
||||
if (z.index<(z.parent.childs.length-1)){
|
||||
z=z.parent.childs[z.index+1];
|
||||
this._updateLine(z);
|
||||
this._updateParentLine(z);
|
||||
}
|
||||
else if (z.index!=0){
|
||||
z=z.parent.childs[z.index-1];
|
||||
this._updateLine(z);
|
||||
this._updateParentLine(z);
|
||||
if (z.childs.length)
|
||||
this._h2.forEachChild(z.id,function(c_el){
|
||||
this._updateParentLine(c_el)
|
||||
},this)
|
||||
}
|
||||
});
|
||||
this.attachEvent("onOpen",function(id,state){
|
||||
if (state){
|
||||
var z=this._h2.get[id];
|
||||
for (var i=0; i < z.childs.length; i++)
|
||||
this._updateParentLine(z.childs[i]);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
this.attachEvent("onBeforeRowDeleted",function(id){
|
||||
var self=this;
|
||||
var z=this._h2.get[id];
|
||||
var w=null;
|
||||
if (z.index!=0)
|
||||
w=z.parent.childs[z.index-1];
|
||||
z=z.parent;
|
||||
|
||||
window.setTimeout(function(){
|
||||
z = self._h2.get[z.id];
|
||||
if (!z) return;
|
||||
|
||||
self._updateLine(z);
|
||||
self._updateParentLine(z);
|
||||
|
||||
if (w){
|
||||
self._updateLine(w);
|
||||
if (w.state=="minus")
|
||||
self._h2.forEachChild(w.id,function(z){
|
||||
self._updateParentLine(z);
|
||||
},self);
|
||||
}
|
||||
},1);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
|
||||
@ -0,0 +1,251 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
if (window.dhtmlxHierarchy){
|
||||
|
||||
if (window.dhtmlXCellObject)
|
||||
dhtmlXCellObject.prototype.attachPropertyGrid = function() {
|
||||
var p = this.attachGrid();
|
||||
new dhtmlXPropertyGrid(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
function eXcell_tree_property(cell){
|
||||
if (cell){
|
||||
this.cell = cell;
|
||||
this.grid = this.cell.parentNode.grid;
|
||||
}
|
||||
this.isDisabled = function(){ return true; }
|
||||
this.getValue = function(){
|
||||
return this.cell.parentNode.valTag.innerHTML;
|
||||
}
|
||||
}
|
||||
eXcell_tree_property.prototype = new eXcell_tree;
|
||||
eXcell_tree_property.prototype.setValue = function(valAr){
|
||||
if (this.cell.parentNode.imgTag)
|
||||
return this.setLabel(valAr);
|
||||
|
||||
|
||||
if ((this.grid._tgc.iconTree==null)||(this.grid._tgc.iconTree!=this.grid.iconTree)){
|
||||
var _tgc={};
|
||||
_tgc.imst="<img src='"+this.grid.iconTree;
|
||||
_tgc.imsti="<img src='"+(this.grid.iconURL||this.grid.iconTree);
|
||||
_tgc.imact="' align='absmiddle' onclick='this."+(_isKHTML?"":"parentNode.")+"parentNode.parentNode.parentNode.parentNode.grid.doExpand(this);event.cancelBubble=true;' class='property_image'>"
|
||||
_tgc.plus=_tgc.imst+"plus.gif"+_tgc.imact;
|
||||
_tgc.minus=_tgc.imst+"minus.gif"+_tgc.imact;
|
||||
_tgc.blank=_tgc.imst+"blank.gif"+_tgc.imact;
|
||||
_tgc.start="<div style=' overflow:hidden; white-space : nowrap; height:"+(_isIE?20:19)+"px;'>";
|
||||
|
||||
_tgc.itemim="<span "+(_isFF?"style='position:relative; top:2px;'":"")+"id='nodeval'>";
|
||||
_tgc.close="</span><div class='property_space'></div></div>";
|
||||
this.grid._tgc=_tgc;
|
||||
}
|
||||
var _h2=this.grid._h2;
|
||||
var _tgc=this.grid._tgc;
|
||||
|
||||
var rid=this.cell.parentNode.idd;
|
||||
var row=this.grid._h2.get[rid];
|
||||
|
||||
if (this.grid.kidsXmlFile || this.grid._slowParse) {
|
||||
row.has_kids=(row.has_kids||(this.cell.parentNode._attrs["xmlkids"]&&(row.state!="minus")));
|
||||
row._xml_await=!!row.has_kids;
|
||||
}
|
||||
|
||||
|
||||
row.image=row.image||(this.cell._attrs["image"]||"leaf.gif");
|
||||
row.label=valAr;
|
||||
|
||||
var html=[_tgc.start];
|
||||
|
||||
//if has children
|
||||
if(row.has_kids){
|
||||
html.push(_tgc.plus);
|
||||
row.state="plus"
|
||||
}
|
||||
else
|
||||
html.push(_tgc.imst+row.state+".gif"+_tgc.imact+_tgc.itemim);
|
||||
|
||||
html.push(row.label);
|
||||
html.push(_tgc.close);
|
||||
|
||||
|
||||
|
||||
this.cell.innerHTML=html.join("");
|
||||
this.cell.style.paddingLeft="0px";
|
||||
this.cell.parentNode.imgTag=this.cell.childNodes[0].childNodes[0];
|
||||
this.cell.parentNode.valTag=this.cell.childNodes[0].childNodes[1];
|
||||
if (row.childs.length) {
|
||||
this.grid.getRowById(this.cell.parentNode.idd)._attrs["class"] = " dhx_parent_row ";
|
||||
this.cell.nextSibling.style.borderLeft="1px solid #D4D0C8";
|
||||
}
|
||||
|
||||
if (_isKHTML) this.cell.vAlign="top";
|
||||
if (row.parent.id!=0 && row.parent.state=="plus"){
|
||||
this.grid._updateTGRState(row.parent,false);
|
||||
this.cell.parentNode._skipInsert=true;
|
||||
}
|
||||
|
||||
this.grid.callEvent("onCellChanged",[rid,this.cell._cellIndex,valAr]);
|
||||
}
|
||||
}
|
||||
|
||||
function eXcell_list(cell){
|
||||
if (cell){
|
||||
this.cell=cell;
|
||||
this.grid=this.cell.parentNode.grid;
|
||||
}
|
||||
this.edit=function(){
|
||||
this.cell.innerHTML="<select style='width:100%;' ></select>";
|
||||
this.obj=this.cell.firstChild;
|
||||
this.obj.onclick=function(e){
|
||||
(e||event).cancelBubble=true
|
||||
}
|
||||
this.obj.onmousedown=function(e){
|
||||
(e||event).cancelBubble=true
|
||||
}
|
||||
this.obj.onkeydown=function(e){
|
||||
var ev = (e||event);
|
||||
|
||||
if (ev.keyCode == 9 || ev.keyCode == 13){
|
||||
globalActiveDHTMLGridObject.entBox.focus();
|
||||
globalActiveDHTMLGridObject.doKey({
|
||||
keyCode: ev.keyCode,
|
||||
shiftKey: ev.shiftKey,
|
||||
srcElement: "0"
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
ev.cancelBubble=true
|
||||
}
|
||||
|
||||
var self=this;
|
||||
this.obj.onchange=function(){
|
||||
self.grid.editStop();
|
||||
self=null;
|
||||
}
|
||||
|
||||
|
||||
var opt=this.getAttribute("values").split(",");
|
||||
for (var i=0; i < opt.length; i++)
|
||||
this.obj.options[i]=new Option(opt[i],opt[i]);
|
||||
this.obj.value=this.cell._val
|
||||
this.obj.focus()
|
||||
}
|
||||
this.getValue=function(){
|
||||
return this.cell._val;
|
||||
}
|
||||
|
||||
this.detach=function(){
|
||||
var val=this.obj.value;
|
||||
var sel=this.obj.selectedIndex;
|
||||
this.setValue(sel==-1?"":this.obj.options[sel].value);
|
||||
return val!= this.getValue();
|
||||
}
|
||||
}
|
||||
eXcell_list.prototype=new eXcell;
|
||||
|
||||
eXcell_list.prototype.setValue=function(val){
|
||||
this.cell._val=val;
|
||||
if (!val||val.toString()._dhx_trim() == ""){
|
||||
this.cell._clearCell=true;
|
||||
this.setCValue(" ","");
|
||||
} else {
|
||||
this.cell._clearCell=false;
|
||||
this.setCValue(this.grid._aplNF(val, this.cell._cellIndex));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function dhtmlXPropertyGrid(cont){
|
||||
var t;
|
||||
if (cont.objBox)
|
||||
t = cont;
|
||||
else
|
||||
t = new dhtmlXGridObject(cont);
|
||||
|
||||
t.setHeader("Name,Value");
|
||||
t.setColAlign("left,left");
|
||||
|
||||
if (window.dhtmlxHierarchy){
|
||||
//treegrid available
|
||||
t.setColTypes("tree_property,ro");
|
||||
t.isTreeGrid=function(){return true;}
|
||||
t.enableSmartXMLParsing(false)
|
||||
} else
|
||||
t.setColTypes("ro,ro");
|
||||
t.setColSorting("na,na")
|
||||
t.setInitWidths("*,*");
|
||||
t.setNoHeader(true);
|
||||
t.setSkin("dhx_skyblue");
|
||||
t.entBox.className += " gridbox_property";
|
||||
|
||||
t.i18n.validation_error="Value is incorrect";
|
||||
t.attachEvent("onRowSelect",function(id,ind){
|
||||
if (!this.editor){
|
||||
this.selectCell(this.getRowIndex(id),1);
|
||||
this.editCell();
|
||||
}
|
||||
})
|
||||
t.attachEvent("onBeforeSelect",function(id){
|
||||
//if (this._h2 && this._h2.get[id].childs.length) return false;
|
||||
if (this._block_selection) return false;
|
||||
return true;
|
||||
})
|
||||
t.attachEvent("onRowCreated",function(id,row){
|
||||
if (!this._h2 || !this._h2.get[id].childs.length){
|
||||
row.childNodes[1].style.backgroundColor="white";
|
||||
}
|
||||
})
|
||||
t.attachEvent("onEditCell",function(stage,id,ind,nv,ov){
|
||||
if (stage==1 && this.editor && this.editor.obj && this.editor.obj.select)
|
||||
this.editor.obj.select();
|
||||
if (stage==2 && ov!=nv) {
|
||||
var val=this.cells(id,1).getAttribute("validate");
|
||||
var result=true;
|
||||
switch(val){
|
||||
case "int":
|
||||
result=(parseFloat(nv)==nv);
|
||||
break;
|
||||
}
|
||||
if (result){
|
||||
this._block_selection=false;
|
||||
this.callEvent("onPropertyChanged",[this.cells(id,0).getValue(),nv,ov]);
|
||||
} else {
|
||||
alert(this.i18n.validation_error);
|
||||
this._block_selection=true;
|
||||
var self=this;
|
||||
window.setTimeout(function(){
|
||||
self.selectCell(id,ind)
|
||||
self.editCell();
|
||||
},1)
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
t._key_events.k13_0_0=t._key_events.k9_0_0=t._key_events.k40_0_0;
|
||||
t.getProperties=function(){
|
||||
this.editStop(true);
|
||||
var data={};
|
||||
this.forEachRow(function(id){
|
||||
data[this.cells(id,0).getValue()]=this.cells(id,1).getValue();
|
||||
});
|
||||
return data;
|
||||
}
|
||||
t.setProperties=function(data){
|
||||
this.editStop();
|
||||
this.forEachRow(function(id){
|
||||
var t=this.cells(id,0).getValue();
|
||||
if (typeof data[t] != "undefined")
|
||||
this.cells(id,1).setValue(data[t]);
|
||||
})
|
||||
this.callEvent("onPropertyChanged",[]);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
Reference in New Issue
Block a user