Hi,
i created a custom excell using the following code.
function eXcell_mytime(cell){ //excell name is defined here
if (cell){ //default pattern, just copy it
this.cell = cell;
this.grid = this.cell.parentNode.grid;
}
this.setValue=function(val){
if(val == ""){
var opts = get_options();
var row_id = this.cell.parentNode.id;
this.cell.innerHTML="<select id='combo_'"+row_id+" style='width:250px;'>"+opts+"</select>";
}
else{
this.setCValue(val);
}
}
this.getValue=function(){
return this.cell.innerHTML; // get value
}
this.edit=function(){
this.val = this.getValue(); //save current value
var opts = get_options();
var row_id = this.cell.parentNode.id;
this.cell.innerHTML="<select id='combo_'"+row_id+" style='width:250px;'>"+opts+"</select>"; // editor's html
this.cell.firstChild.value=parseInt(val); //set the first part of data
this.cell.childNodes[0].onclick=function(e){ (e||event).cancelBubble=true; } //block onclick event
}
this.detach=function(){
this.setValue(this.cell.childNodes[0].value); //set the new value
return this.val!=this.getValue(); // compare the new and the old values
}
}
eXcell_mytime.prototype = new eXcell; // nest all other methods from base class
But this excell is not working correctly,I am unable to select the item from the drop down list created using the excell code.
Is there some problem in the code? Please help soon, i have been stuck on it for two weeks.
selecting of the options in your select works well for us.
Please, make sure that you’ve provided the actual code.
in the provided sample you need replace
this.cell.firstChild.value=parseInt(val); //set the first part of data
with
this.cell.firstChild.value=parseInt(this.val); //set the first part of data
also, please, check your response from the get_options() function.
Hi,
can it be because my options are actually text?
the options are something like “ABD::123.23.00”
If this is so what do i need to replace parseInt with?
Thank you,
changing this.cell.firstChild.value=parseInt(val); //set the first part of data
to
this.cell.firstChild.value=parseInt(this.val); //set the first part of data
worked
dhtmlXComboFromSelect method should help you.
Something like this:
...
this.cell.innerHTML="<select id='combo_'"+row_id+" style='width:250px;'>"+opts+"</select>"; // editor's html
this.cell.firstChild.value=parseInt(this.val); //set the first part of data
var z=dhtmlXComboFromSelect('combo_'+row_id)
Hi,
i am sorry, I must have misunderstood something.
My grid now shows a combo box with filtering, but when i select the option from the combo, it shows “undefined” in the grid.
Whereas if I remove the statements
var z = dhtmlXComboFromSelect(‘combo_’+row_id);
z.enableFilteringmode(‘between’);
from the code, it works perfectly fine.
I placed these lines after the statement
this.cell.firstChild.value=parseInt(this.val); like your answer suggested.