Hi, i'm loading my datasourcce from a viewbag
DataSource = (IEnumerable<object>)ViewBag.DataSource,
QueryString = "test",
ShowColumnMenu = true,
when i add a record i want to update, i am assigning it an id to be able to update it but it doesn't respect it
Columns = new List<Syncfusion.EJ2.Grids.GridColumn>
{
new Syncfusion.EJ2.Grids.GridColumn(){ Field="", HeaderText="", IsPrimaryKey=true, Width=""} ,
// new Syncfusion.EJ2.Grids.GridColumn(){ Field="", HeaderText="", Width=""} ,
new Syncfusion.EJ2.Grids.GridColumn(){ Field="", HeaderText="", Width=""} ,
//new Syncfusion.EJ2.Grids.GridColumn(){ Field="", HeaderText="", Width=""} ,
new Syncfusion.EJ2.Grids.GridColumn(){ Field="", HeaderText="", Width=""} ,
new Syncfusion.EJ2.Grids.GridColumn(){ Field="", HeaderText="", Width=""} ,
new Syncfusion.EJ2.Grids.GridColumn(){ Field="", HeaderText="", Width=""} ,
//new Syncfusion.EJ2.Grids.GridColumn(){ Field="", HeaderText="", Width=""} ,
new Syncfusion.EJ2.Grids.GridColumn(){ Field="", HeaderText="", Width=""} ,
new Syncfusion.EJ2.Grids.GridColumn(){HeaderText="Agregar ", Template="#btnTemplate"}
},Id="SegundoNivel",
this is my function to update and reload the view bag
function factura(e) {
console.log("Bloque-"+ e);
$.ajax({
url: "@Url.Action("Add", "Consulta", new {area="Mantenimiento" }, Request.Url.Scheme)",
data: { id: e },
success: function (nivel2) {
if (nivel2.success) {
var grid = document.getElementById("SegundoNivel").ej2_instances[0];
console.log(grid);
grid.dataSource = nivel2.nivel2
} else {
swal.fire({
title: "Operacion incorrecta",
text: nivel2.responseText,
type: "error"
})
}
}
})
}