cell width of normal cells also changing if the grid has cus

Hi ,



i have created custom cell for auto search functionality and it is changing width of cell as per content not as per width setup while initilizing the grid by using setInitWidthsP.

and when i set value to normal cell also width of cell is changing as per content .The alignment of

cell and grid also changing.

is there any way to restore the grid cell width to initial value and alignment?.



The code for custom cell :



function eXcell_autonar(cell){

if(cell){

this.cell = cell;

this.grid = this.cell.parentNode.grid;



}

this.autoc=function() {



return ‘CVSearchlist.do?type=region&typing=’+document.getElementById(“auto_combo”).value



}

this.autocustom1=function(){

return urlcustom+’&type=am&typing=’+document.getElementById(“auto_combo”).value

}

this.edit = function(){



this.cell.atag=((!this.grid.multiLine)&&(_isKHTML||_isMacOS||_isFF))?“INPUT”:“TEXTAREA”;

this.val = this.getValue();



this.obj = document.createElement(“INPUT”);

this.obj.setAttribute(‘name’,‘auto_combo’);

this.obj.setAttribute(‘id’,‘auto_combo’);





this.obj.style.height =(this.cell.offsetHeight-(_isIE?6:4))+“px”;





this.obj.className=“dhx_combo_edit”;

this.obj.wrap = “soft”;

this.obj.style.textAlign = this.cell.align;

this.obj.onclick = function(e){(e||event).cancelBubble = true}

this.obj.onmousedown = function(e){(e||event).cancelBubble = true}

this.obj.value = this.val

this.cell.innerHTML = " “;



this.cell.appendChild(this.obj);

this.cell.scri=this;





if(_isFF){

this.obj.style.overflow=“visible”;

if((this.grid.multiLine)&&(this.obj.offsetHeight>=18)&&(this.obj.offsetHeight<40)){

this.obj.style.height=“36px”;

this.obj.style.overflow=“scroll”;

}



}



this.url = this.grid.autoComboUrl[this.cell._cellIndex];

if(this.cell._cellIndex == 0)

{

this.autocomplete= new CAPXOUS.AutoComplete(‘auto_combo’,this.autoc, { minChars: 3 });

}

else

this.autocomplete= new CAPXOUS.AutoComplete(‘auto_combo’,this.autocustom1, { minChars: 3 });

this.autocomplete.autoUrl = this.url+”&box="+this.cell._cellIndex;

this.autocomplete.text.manualWidth = 300;



this.obj.onselectstart=function(e){if(!e)e=event;e.cancelBubble=true;return true;};

this.obj.focus()

this.obj.focus()

}



this.getValue = function(){

if((this.cell.firstChild)&&((this.cell.atag)&&(this.cell.firstChild.tagName==this.cell.atag)))

return this.cell.firstChild.value;

else

return this.cell.innerHTML.toString()._dhx_trim();

}

this.getText = function(){

return ‘abc’;

}



this.detach = function(){

alert(“detach”);

this.autocomplete.hide();

if(document.getElementById(“auto_combo”)) {

this.cell.removeChild(this.obj);

this.cell.innerHTML=this.val;

}

window._auto_combo = this;



this.grid.setSizes();

return this.val!=this.getValue();

}



}

eXcell_autonar.prototype = new eXcell;



dhtmlXGridObject.prototype.setAutoCombo = function(col_ind,url,size){

if(this.autoComboUrl==null) {



this.autoComboUrl = new Array(this.cellType.length);

this.autoComboSize = new Array(this.cellType.length);

}



this.autoComboUrl[col_ind]=url;

this.autoComboSize[col_ind]=300;

}

function dhtmlxGrid_auto_setSelHier(box,id,text) {



window._auto_combo.setValue(id);



}





function buildTreeGrid(){

mytogrid = new dhtmlXGridObject(‘gridbox2’);

mytogrid.imgURL = “images/dhtmlxtreegrid/”;

mytogrid.setHeader(“Region/Sales Level 6,Account Manager Id/Team Name,Account Group Name,#cspan,Account CSC Id,#cspan,Coverage,Split %,Reason Code,Comments,Error Msg”);

mytogrid.setInitWidthsP(“18,16,10,2,10,2,6,6,10,10,10”);

mytogrid.setColAlign(“left,left,left,left,left,left,left,left,left,left”);

mytogrid.setColTypes(“autonar,autonar,ro,ro,ed,ro,coro,ed,coro,txt,txt”);

combo = mytogrid.getCombo(6);

combo.put(‘1’,‘Sales Level 1’);

combo.put(‘2’,‘Sales Level 2’);

combo.put(‘3’,‘Sales Level 3’);

combo.put(‘4’,‘Sales Level 4’);

combo.put(‘5’,‘Sales Level 5’);

combo.put(‘6’,‘Sales Level 6’);

mytogrid.setOnEditCellHandler(doOnCellEdit);

mytogrid.setAutoCombo(0,‘CVSearchlist.do?type=region’,300);

mytogrid.setAutoCombo(1,‘CVSearch.do?type=region’,300);

mytogrid.setSkin(“light”);

mytogrid.setOnLoadingEnd(loadingmsg);

mytogrid.init();



}

is there any way to restore the grid cell width to initial value and alignment
There is no public method to do it. You can store original column’s width and alignment at the external variable and restore cell’s width and align from it.