Cell value lost upon sorting in frozen columns


I would like to report what I believe is a bug in the split grid. I managed to reduce the test scenario to the following steps:

  1. Create a grid with 2 columns
  2. Freeze column 0 (split grid at column 1)
  3. Set the column types to ‘co’ and sorting type to ‘str’
  4. Populate the combos with some values
  5. Add two rows to the grid, using empty cells
  6. Set some values for the 4 cells using the combos, so that all cells have a value
  7. Sort grid by the left column

Expected result: the grid rows should be sorted by the values in the first column; the values in the first column should be preserved.

Actual result: the grid is not sorted. The values are shown in view mode, however when editing the cells they are added at the bottom of the combo list with an option value of “” (empty string). So the values are actually lost upon sorting.

A few more details:

  • this only happens on the left side of the split (only for the frozen columns). In my example, sorting by the right column works just fine
  • this only happens if the initial value of the cell is not part of the combo values defined for the cell (in particular, if the initial value is empty)
  • it seems to be happening only for combo cells and only for str sort (but of that I’m not sure)

As a workaround, I took care of always prefilling the combo cells with the first option in the combo, rather than leaving them empty – but this is not always an acceptable solution.

Here’s the code to reproduce the bug:

<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxGrid/codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<script src="/dhx/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<script src="/dhx/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script src="/dhx/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
<script src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_splt.js"></script>

<div id="gridbox" style="width:200px;height:86px;background-color:white;"></div>

mygrid = new dhtmlXGridObject('gridbox');
mygrid.setHeader("Left Column,Right Column");
for (var i = 1; i <= 10; i++) {
  mygrid.getCombo(0).put("leftvalue" + i, "leftvalue" + i);
  mygrid.getCombo(1).put("rightvalue" + i, "rightvalue" + i);
mygrid.addRow((new Date()).valueOf(), "");
mygrid.addRow((new Date()).valueOf(), "");


I’m using a registered version of dhtmlxGrid v.2.5 Professional edition build 91111.

Please advise.

Radu Galesanu

Any idea?

We was able to reconstruct the problem locally.
Fix will be available in few days.