Categories | Question details Back To List | ||
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? Answer posted by Alex (support) on Dec 09, 2009 01:52 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(); mygrid.cells(rowID,5).setValue('uom_id'); }) Answer posted by cheryl tisland on Dec 09, 2009 07:55 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. Answer posted by Alex (support) on Dec 09, 2009 08:44 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 Answer posted by cheryl tisland on Dec 09, 2009 10:15 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? Answer posted by cheryl tisland on Dec 09, 2009 15:13 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? Answer posted on Dec 09, 2009 20:35 Just to reiterate, my xml that is rendered into uomProductCombo.loadXML looks like this: <complete> <option value="1000230">Jug-1.67</option> </complete> 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 Answer posted by Alex (support) on Dec 10, 2009 02:02 Hello, please try to follow to method that we recommended in the previous answer ( http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=13352&a=21700). Try to use var uomProductCombo = mygrid.cells(rowID,5).getCellCombo(); mygrid.cells(rowID,5).setValue(uom_id); mygrid.selectCell(mygrid.getRowIndex(rowID),5,false,false,true,false); }) var uomProductCombo = mygrid.cells(rowID,5).getCellCombo(); Answer posted by cheryl tisland on Dec 10, 2009 05:52 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(); mygrid.cells(rowID,5).setValue(uom_id); }) |