Posted 15 September 2017, 8:04 am EST
Hi Ashish,
We are sorry, I don’t know why full code do not get displayed.
You can blank item with all column properties using following code snippet:
var keys= Object.keys(cvData.items[0]),
item={};
for(var i=0;i<keys.length;i++){
item[keys[i]]=null;
}
cvData.sourceCollection.splice(0,0,item);
cvData.refresh();
For removing blank rows from FlexGrid, you would like to remove the blank rows before updating to the Database.
You know the number of rows added, you need to check for the added rows if a row is blank or not by checking for added rows. Please use the following code snippet for the same:
function isAddedRows(row){
if(row==0){
return true;
}
return false;
}
flex.rowEditEnded.addHandler(function(s,e){
var isEdited=false;
for(var i=0;i<flex.columns.length;i++){
if((s.getCellData(e.row,i)!==null && s.getCellData(e.row,i)!=="") && isAddedRows(e.row)){
isEdited=true;
break;
}
}
if(isEdited){
cvData.itemsAdded.push(flex.rows[e.row].dataItem);
}
console.log(cvData.itemsAdded);
});
You need to update isAddedRows method as per your requirement, how you are adding rows.
Please let me know if you have any further queries, we would be glad to help you.
Thanks,
Manish Kumar Gupta