Hi, I am using dhtmlxTreeGrid_v14_Pro version.
I would like to better understand how to increment the rowid when adding a row…
I have an empty (two calendar columns) “grid.xml” that contains:
<?xml version="1.0" encoding="UTF-8"?>
I am using the following script
and I am trying to add rows with:
mygrid.addRow(new Date().valueOf(),[(new Date()),(new Date())],mygrid.getRowIndex(mygrid.getSelectedId()))
Using form integration and after adding two rows, I get
gridbox_1193410360765_0
gridbox_1193410360765_1
gridbox_1_0
gridbox_1_1
for the corresponding grid cells.
But, instead I would like to get
gridbox_1_0
gridbox_1_1
gridbox_2_0
gridbox_2_1
and so on (for additional rows).
I know I have to replace “new Date().valueOf()” with something else. Please tell what to do…
If you want to have rowID equal to rowIndex you can use
mygrid.addRow(mygrid.getRowsCount()+1,[(new Date()),(new Date())],mygrid.getRowIndex(mygrid.getSelectedId()))
such command will create ID equal to current count of row ( please beware that if you deleting rows in grid - it possible to create situation when proposed above ID will be not unique )