Reputation: 27
I have problem with append row in bootgrid (http://www.jquery-bootgrid.com/)
I have grid with formatter use for insert multi row data
$("#grid-data").bootgrid({
navigation : 0,
selection: true,
multiSelect: true,
formatters : {
"id" : function(col ,row) {
return "<input type='hidden' class='form-control input-md' name='controls[][id]' value='"+row.id+"'/>";
},
"controlCode" : function (column ,row) {
return "<input type='text' class='form-control input-md' name='controls[][controlCode]'/>";
},
"controlName" : function (column ,row) {
return "<input type='text' class='form-control input-md' name='controls[][controlName]'/>";
},
"language" : function (column ,row) {
return languageHtml;
},
"description" : function (column ,row) {
return "<input type='text' class='form-control input-md' name='controls[][description]'/>";
}
}
})
and have button with function to add new blank row
function addRow(){
$("#grid-data").bootgrid("append", [{
id : 0,
controlCode : "",
controlName: "",
language: "",
description: ""
}]);
};
When I input datas then create new blank row ,grid append new blank row but not keep my inputed data before
Any advice for me to keep inputted data? Thanks and sorry for my english
Upvotes: 3
Views: 2291
Reputation: 10705
Since you are always passing the same value (zero) as id, bootgrid thinks this row already exists and just ignore it.
Try using different id values.
Upvotes: 1