Populate column values after adding new row

Currently i have a grid with 4 columns and the first column contains a checkbox. After adding a new row, how do i add a checkbox or input tag to that column? And how do i add a new row as the first row of the grid? Thanks for the help in advance!

If you have defined column as checkbox
grid.setColTypes(“ch,ed,ed,ed”);
The related column in new row will be a checkbox.

To add row at necessary position 3rd parameter of addRow can be used
grid.addRow(id,values,0); // add as first row in grid

The “values” variable is an array of values? I want to enter empty strings into all the columns except for the checkbox column. In the checkbox column, the checkboxes were inserted by tags in my Java file by using CData method. How do i enter html tags into the checkbox column? How can the “values” variable know where to place what?

The “values” variable is an array of values?
It can be a comma separated list or an array.
grid.addRow(id,“1,2,3”)
or
grid.addRow(id,[“1”,“2”,“3”])

>>How can the “values” variable know where to place what?
The data mapped to related column , first element of array to first column of grid, second to second , etc. If you need to enter data in first column you can define only first element of array.

grid.addRow(id,[""]);

By the way , if you are using “ch” column type, you need not define any HTML tags, grid will automatically render checkbox for such cells, the 0 as value will result in unchecked checkbox, 1 as value - checked checkbox

I am using my own checkbox, but if i use the inbuilt “ch” is there anyway i can rename the checkbox name and id? As i would need to do some validation with it. Btw, the html code worked for the addRow.

but if i use the inbuilt “ch” is there anyway i can rename the checkbox name and id
The checkboxes created for “ch” column are nameless and can be accessed only through grid’s API

Thank you, you have been very helpful. I think i will have to use my own tag for the checkboxes.