Add row when last row is not empty

Please I need to add row to grid just when the last row is not empty.

i don’t want to let the user add undefined rows when the row before is empty.

thank you

function clever_add(){
var last = grid.getRowsNum()-1;
if (grid.cells2(last,0).getValue()=="") return;



the code above check cell in last row , and skip addRow command when cell in last row is empty