combo in grid

I am setting a grid combo after values are returned to the grid from a lookup in one grid field.

Basically, I enter a value in a column field in the grid and through ajax pull in the other columns in the grid through a search from that value.



Now, I initialize my grid combo as follows:

var uomProductCombo = mygrid.cells(rowID,5).getCellCombo();

uomProductCombo.loadXML(“functions/buildSpecialCombos.php?..”)



mygrid.cells(rowID,5).setValue(‘uom_id’); //I get the uom_id earlier in the code



Now the drop down in the combo shows all of the correct options from the loadXML, however, the setValue sets the option value rather than option label until I tab over it in the grid.



So basicly, I am in column 2 and enter a value, it goes out through ajax and looks up a record for that value and returns the information for the other columns. I then set the column 5 as shown above, but it shows id rather than label until I tab over it.



Any way to correct this?


Hello,


try to cell value after combo xml is loaded. In this case the corresponding text will be found automatically:


var uomProductCombo = mygrid.cells(rowID,5).getCellCombo();
uomProductCombo.loadXML(“functions/buildSpecialCombos.php?..”,function(){


mygrid.cells(rowID,5).setValue(‘uom_id’);


})




Yes, that is exactly what I am doing.  It shows the ID value first, but then when I tab over the field, it changes to the display value.  The problem is, people won’t always know to tab over it to make it change.


The issue wasn’t reproduced locally.


Which grid version do you use ? Please provide the complete demo, that allows to recreate the issue, to support@dhtmlx.com

I am not exactly sure which version of the grid I am using, but for the heck of it, I just tried it with the dhtmlxgrid_excell_combo.js that I received for an evaluation for version 2.5 and it also produces the same result.

What would you like me to send you?  I assume just where I set up the grid and where I get the values?

I have even tried to do a hack where I go into the cell in edit mode and then back out, but that seems to just clear the value.

var uomProductCombo = mygrid.cells(rowID,5).getCellCombo();

uomProductCombo.loadXML(“functions/buildSpecialCombos.php?..”)


mygrid.cells(rowID,5).setValue(uom_id);

window.setTimeout(function() {
mygrid.selectCell(mygrid.getRowIndex(rowID),5,false,false,true,false);
},5);
mygrid.getRowIndex(rowID),3,false,false,true,false);

Like I said, doing this just seems to clear the value out of the combo cell.

Do you have any other suggestions?

Just to reiterate, my xml that is rendered into uomProductCombo.loadXML looks like this:


    Jug-1.67


Then after calling the loadXML, I do this:

mygrid.cells(rowID,5).setValue(‘1000230’);

What I see in the grid is 1000230 until I tab into the column at which point it instantly changes to Jug-1.67

What I need is a way for this to show Jug-1.67 without having to tab into the column.


Thanks for all your help


Hello,


please try to follow to method that we recommended in the previous answer ( dhtmlx.com/docs/products/kb/inde … 52&a=21700). Try to use


var uomProductCombo = mygrid.cells(rowID,5).getCellCombo();
uomProductCombo.loadXML(“functions/buildSpecialCombos.php?..”,function(){


mygrid.cells(rowID,5).setValue(uom_id);


mygrid.selectCell(mygrid.getRowIndex(rowID),5,false,false,true,false);


})


instead of



var uomProductCombo = mygrid.cells(rowID,5).getCellCombo();
uomProductCombo.loadXML(“functions/buildSpecialCombos.php?..”)

mygrid.cells(rowID,5).setValue(uom_id);

window.setTimeout(function() {
mygrid.selectCell(mygrid.getRowIndex(rowID),5,false,false,true,false);
},5);




awesome!  That works and I don’t even have to do the selectCell after, so I changed it like below and it works great.






Thank you







var uomProductCombo = mygrid.cells(rowID,5).getCellCombo(); 
uomProductCombo.loadXML(“functions/buildSpecialCombos.php?..”,function(){


mygrid.cells(rowID,5).setValue(uom_id);

})