DHX Grid : Problem after Drag-n-Drop.

Hi there,

I am having all integer starting from 1 in first column of grid(thats default).

Also the row IDs are starting from 1.

When I do drag-n-drop, I want that data which is shown for first column should always start from 1 and so on… (I have done this)

Also I want the id of the row not to change, means it should also be same as starting from 1 and so on even after drag-n-drop…

How to achieve this ?

it should also be same as starting from 1 and so on even after drag-n-drop
Technically it can be done as
grid.attachEvent(“onDrop”,function(){
for (var i=0; i<grid.getRowsNum(); i++)
grid.setRowId(i,i+1);
});

each time after d-n-d , code will loop through grid and change IDs

Hi there,
             I have written the code like following.
     
             libTableGrid.attachEvent(“onDrop”,function(){
                                                        for (var i=0; i<libTableGrid.getRowsNum(); i++)
                                                       {
                                                            var j = i+1;
                                                            libTableGrid.cells2(i,0).setValue(j);
                                                       }
                                                      
                                                        for (var i=0; i<libTableGrid.getRowsNum(); i++)
                                                             libTableGrid.setRowId(i,i+1);
                                    });   

                           Before doing d-n-d, I am able to get the CSV data of the grid, but after d-n-d, I am not able to get the CSV data.

                          Also whats the difference between
 
                          libTableGrid.cells2(i,0).setValue(j);
                          and
                          libTableGrid.cells(i,0).setValue(j);
                       
                          ???           
             

Also whats the difference between <BR>cells use row ID as first parameter<BR>cells2 use row Index as first parameter<BR><BR>>>     Before doing d-n-d, I am able to get the CSV data of the grid, but after d-n-d, I am not able to get the CSV data.<BR>Problem confirmed,  you need to replace <BR>                                                        for (var i=0; i<libTableGrid.getRowsNum(); i++)<BR>                                                             libTableGrid.setRowId(i,i+1);<BR><BR>with <BR><BR>                                                        for (var i=0; i<libTableGrid.getRowsNum(); i++)<BR>                                                        	libTableGrid.setRowId(i,"a"+i);<BR>                                                        for (var i=0; i<libTableGrid.getRowsNum(); i++)<BR>                                                        	libTableGrid.setRowId(i,i+1);<BR><BR>