Im breaking my head and cant figure out how to append data, just for testing pourpuses i did this :
var JSONINFO = {"rows": [{"id": 19, "sender": "[email protected]", "received": "2014-05-30T22:15:00", "status":"Garantia"},{"id": 19, "sender": "[email protected]", "received": "2014-05-30T22:15:00", "status":"Garantia"} ]};
var result = [];
for(var i in JSONINFO) result.push([i, JSONINFO [i]]);
$("#grid-basic").bootgrid().bootgrid("append",result.rows);
but cannot insert data in the table ... can anyone clarify the format that the array should have ?, or a more comprehensive example? ... Thanks a lot !
I had the same problem with my grid. The problem was that I was loading my grid with ajax.
Removing the ajax: true
and/or setting it to the default false
solved the "append", "remove" and "clear" problem but I had to solve the loading problem.
In my case, I decided not using the grid "append" function and reload the grid data with a server side call. $("#myGrid").bootgrid('reload')
I am not happy with the solution but at least I found the problem I had
var grid = $("#myGrid").bootgrid({
ajax: false,
formatters: {
"commands": function (column, row) {
return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.id + "\"><span class=\"fa fa-pencil\"></span></button> " +
"<button type=\"button\" class=\"btn btn-xs btn-default command-delete\" data-row-id=\"" + row.id + "\"><span class=\"fa fa-trash-o\"></span></button>";
}
}
})
Just use it like this:
var JSONINFO = {"rows": [{"id": 19, "sender": "[email protected]", "received": "2014-05-30T22:15:00", "status":"Garantia"},{"id": 19, "sender": "[email protected]", "received": "2014-05-30T22:15:00", "status":"Garantia"} ]};
$("#grid-basic").bootgrid("append", JSONINFO.rows);
Try replacing:
bootgrid("append",result.rows);
with:
bootgrid("append",result.d);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With