/* Product Name: dhtmlxSuite Version: 4.0.3 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._init_point_bcg = dhtmlXGridObject.prototype._init_point; dhtmlXGridObject.prototype._init_point = function() { if (!window.dhx_globalImgPath) window.dhx_globalImgPath = this.imgURL; this._col_combos = []; for (var i=0; i/g,">"),this.combo.getActualValue()); this.cell._clearCell = false; } this.combo._confirmSelect(); this.cell.combo_value = this.combo.getActualValue(); this.combo.closeAll(); this.grid._still_active=true; this.grid.setActive(1); return val!=this.cell.combo_value; } } eXcell_combo.prototype = new eXcell; eXcell_combo_v = function(cell){ var combo = new eXcell_combo(cell); combo._combo_pre = ""; return combo; }; eXcell_combo.prototype.initCombo = function(index){ var container = document.createElement("DIV"); var type = this.grid.defVal[arguments.length?index:this.cell._cellIndex]; var combo = new dhtmlXCombo(container, "combo", 0, type); this.grid.defVal[arguments.length?index:this.cell._cellIndex] = ""; combo.DOMelem.className += " dhxcombo_in_grid"; var grid = this.grid; combo.DOMelem.onselectstart = function(){ event.cancelBubble = true; return true; }; combo.attachEvent("onKeyPressed",function(ev){ if (ev==13 || ev==27) { grid.editStop(); if (grid._fake) grid._fake.editStop(); } }); dhtmlxEvent(combo.DOMlist, "click", function(){ grid.editStop(); if (grid._fake) grid._fake.editStop(); }); return combo; }; eXcell_combo.prototype.fillColumnCombos = function(grid,xml){ if (!xml) return; grid.combo_columns = grid.combo_columns||[]; columns = grid.xmlLoader.doXPath("//column", xml); for (var i=0; i"+value+""; } if (arguments.length > 1) { this.setCValue(value,value2); } else { this.setCValue(value); } }; eXcell_combo.prototype.setComboOptions = function(combo, obj, grid, index, idd) { if (window.dhx4.s2b(obj.getAttribute("xmlcontent"))) { if (!obj.getAttribute("source")) { options = obj.childNodes; var _optArr = []; for (var i=0; i < options.length; i++){ if(options[i].tagName =="option"){ var text_opt = options[i].firstChild? options[i].firstChild.data:""; _optArr[_optArr.length]= [options[i].getAttribute("value"),text_opt]; } } combo.addOption(_optArr) if(arguments.length == 4){ grid.forEachRowA(function(id){ var c = grid.cells(id,index); if(!c.cell._brval&&!c.cell._cellType&&(c.cell._cellIndex==index)){ if(c.cell.combo_value=="") c.setComboCValue(" ",""); else{ if(!combo.getOption(c.cell.combo_value)) c.setComboCValue(c.cell.combo_value); else c.setComboCValue(combo.getOption(c.cell.combo_value).text); } } }); } else { var c = (this.cell)?this:grid.cells(idd,index); if(obj.getAttribute("text")) { if(obj.getAttribute("text")._dhx_trim()=="") c.setComboCValue(" ",""); else c.setComboCValue(obj.getAttribute("text")); } else{ if((!c.cell.combo_value)||(c.cell.combo_value._dhx_trim()=="")) c.setComboCValue(" ",""); else{ if(!combo.getOption(c.cell.combo_value)) c.setComboCValue(c.cell.combo_value); else c.setComboCValue(combo.getOption(c.cell.combo_value).text); } } } } } if (obj.getAttribute("source")) { if (obj.getAttribute("auto") && window.dhx4.s2b(obj.getAttribute("auto"))) { if (obj.getAttribute("xmlcontent")) { var c = (this.cell)?this:grid.cells(idd,index); if (obj.getAttribute("text")) c.setComboCValue(obj.getAttribute("text")); } else { grid.forEachRowA(function(id){ var c = grid.cells(id,index); if (!c.cell._brval && !c.cell._cellType) { var str = c.cell.combo_value.toString(); if (str.indexOf("^") != -1) { var arr = str.split("^"); c.cell.combo_value = arr[0]; c.setComboCValue(arr[1]); } } }); } combo.enableFilteringMode(true, obj.getAttribute("source"), window.dhx4.s2b(obj.getAttribute("cache")||true), window.dhx4.s2b(obj.getAttribute("sub")||false)); } else { var that = this; var length = arguments.length; combo.load(obj.getAttribute("source"), function(){ if (length == 4) { grid.forEachRow(function(id){ var c = grid.cells(id,index); if (!c.cell._brval && !c.cell._cellType) { if (combo.getOption(c.cell.combo_value)) { c.setComboCValue(combo.getOption(c.cell.combo_value).text); } else { if ((c.cell.combo_value||"").toString()._dhx_trim() == "") { c.setComboCValue(" ",""); c.cell._clearCell=true; } else { c.setComboCValue(c.cell.combo_value); } } } }); } else { //var c = (that.cell)? that : grid.cells(idd,index); var c = grid.cells(idd,index); //c.setCValue(obj.getAttribute("text")); if (combo.getOption(c.cell.combo_value)) { c.setComboCValue(combo.getOption(c.cell.combo_value).text); } else { c.setComboCValue(c.cell.combo_value); } } }); } } if (!obj.getAttribute("auto") || !window.dhx4.s2b(obj.getAttribute("auto"))) { if (obj.getAttribute("editable") && !window.dhx4.s2b(obj.getAttribute("editable"))) combo.readonly(true); if (obj.getAttribute("filter") && window.dhx4.s2b(obj.getAttribute("filter"))) combo.enableFilteringMode(true); } }; eXcell_combo.prototype.getCellCombo = function() { if (this.cell._brval) return this.cell._brval; this.cell._brval = this.initCombo(); return this.cell._brval; }; eXcell_combo.prototype.refreshCell = function() { this.setValue(this.getValue()); }; dhtmlXGridObject.prototype.getColumnCombo = function(index) { if (this._col_combos && this._col_combos[index]) return this._col_combos[index]; if (!this._col_combos) this._col_combos = []; this._col_combos[index] = eXcell_combo.prototype.initCombo.call({grid:this},index); return this._col_combos[index]; }; dhtmlXGridObject.prototype.refreshComboColumn = function(index) { this.forEachRow(function(id){ if (this.cells(id,index).refreshCell) this.cells(id,index).refreshCell(); }); };